After having some success in some basic game code for RETRO using the OC-provided DisplayN18 driver’s fillRect API, I wanted to see if I could work with bitmaps.
I did a prototype that used the DisplayN18 driver’s setPixel API, but that seemed kind of cumbersome. I re-discovered @ taylorza’s LCD_ST7735 driver library, which also works with the Display N18, since it uses the ST7735 controller. Chris’ library also has APIs specifically for drawing bitmaps on the screen, both a full bitmap, and a portion of a bitmap (useful for sprite sheets, for example).
However…as far as I’m aware, there isn’t any way to upload bitmap files to the mbed online IDE, and even if there were, I’m not sure how you’d use the file.
For my prototype, I simply created an array of type bool, and used a 1 to indicate a white pixel, and 0 to indicate a black pixel, and used the setPixel API to draw the appropriate color while looping through the array.
Similarly, I was able to get a prototype of drawing a bitmap with the LCD_ST7735 library’s drawBitmap function by creating an array of uint16_t containing the color value for each pixel, using the Color565 class Chris also includes in the library.
But creating this array manually is exceedingly tedious, so I was wondering if anyone is aware of either utilities or techniques for converting an existing bitmap image file into the required array? I could probably whip something up myself, but figured it made sense to ask before reinventing the wheel.