strawdynamics / pdbmp

BMP loader for Playdate, written in Nim

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

pdbmp

Demo footage of pdbmp example apps

BMP loader for Playdate, written in Nim. Designed primarily for use with 8bpp BMP files (palletted 256 color). Also supports 1, 4, and 32bpp. 16 and 24bpp files not currently supported. This could be used for:

  • Sampling grayscale textures for use in "mode 7" or similar 2.5/3D applications.
  • Working in color or grayscale and applying an "auto dither" on Playdate. In particular, rendering at 2x can give you something similar in both perceived bit depth and effective resolution to the original Game Boy.
  • Making tilemaps if you wanted to avoid using something like LDtk for whatever reason.
  • Storing normal or other maps
  • ???

Limitations

  • No good docs or easy install.
  • No Lua bindings.
  • Only supports BMP files with BITMAPCOREHEADER, BITMAPINFOHEADER or BITMAPV3INFOHEADER.
  • No 16/24bpp BMP support. I highly recommend working with 8bpp or less.
  • Compressed BMPs not supported.
  • Ignores concept of "important" colors.

Resources

Demo asset credits

Want to help?

Contributing

Thanks for your interest in contributing to pdbmp! Before you get started:

  1. Read and agree to follow the code of conduct (Contributor Covenant 2.1).
  2. This was the first thing I wrote in Nim, and I don't have a lot of experience with languages like C/C++ (or binary file parsing, for that matter). Please be gentle!
  3. Before you start work, check the open issues to make sure there isn't an existing issue for the fix or feature you want to work on.
  4. If there's not already a relevant issue, open a new one. Your new issue should describe the fix or feature, why you think it's necessary, and how you want to approach the work (please use one of the issue templates).
  5. Project maintainers will review your proposal and work with you to figure out next steps!

Running locally

nimble develop

nimble simulate

# Kinda sorta gets you partway toward something that could be probably used with C, if you add `exportc` throughout the code
nim c --nimcache:./.nc --header:libpdbmp.h --compileOnly --app:staticlib src/pdbmp.nim

About

BMP loader for Playdate, written in Nim

License:MIT License


Languages

Language:C 56.8%Language:HTML 27.7%Language:Nim 14.6%Language:Makefile 1.0%