using SD instead of progmem to store binary bitmaps

Ok so I built this library based on an arduino project called Gamebuino. A gaming library that allows any one to easily build and play games on an arduino. The OG library uses a low res nokia 5110 screen but I was unhappy with not being able to display 3 colors so I found a really cheap one at $4.99 that any one could afford. I realized quickly that using a regular arduino which only has 32kb progmem was not going to build any good games so I switched to a teensy 3.2 which has a 32bit processor along with 256k progmem. That’s a whole lot better but I want full use of the processor and really raelly nice games I was gonna need way more space than any progmem chip currently made by arduino or one of the 3rd parties would allow.

So instead of using progmem I would like to be able to store my bitmaps on the sd card instead which will give more room for programming and as much visual data as will ever be needed.

all right so to draw a bitmap and display it currently is this method…

const byte green_square PROGMEM = {16,16, B00000000,etc

then to call it I use

display.drawbitmap(16,16,green_square,xpos,ypos,green)

the x and y pos is the placement on screen, green sets the color

ok so just to make it easier and im thinking faster too, I would still like to store the bitmaps the same way on sd as progmem as you can stack monochrome color bitmaps that way with each bitmap filling in the right colors. If at all possible but im worried about trying to call so many bitmaps at once since each one is for a different color. or would it be easier to store and display the full 3 to 4 color bitmap.

So basically I want to store a Sprite sheet on the sd and them call them in program.

would any body have any suggestions

I built the library but I’m still learning arduino programming so please keep that in mind

Could I do a #include and include the Sprite sheet from SD by open()

gamebuinoduhjokercolorMAIN1.zip (38.5 KB)

ok so just to make it easier and im thinking faster too,

Reading from an SD card is going to be orders of magnitude slower than reading from memory, whether that memory is Flash memory or SRAM, so you can forget faster.

im worried about trying to call so many bitmaps at once

You can NOT call a bitmap. You can ONLY call functions. That the function DRAWs a bitmap is irrelevant.

Whether or not displaying two or more bitmaps simultaneously is possible or produces t he result that you want depends EXCLUSIVELY on how drawBitmap() is implemented.

So basically I want to store a Sprite sheet on the sd and them call them in program.

Since you can't call a bitmap, that seems unlikely.

Could I do a #include and include the Sprite sheet from SD by open()

Absolutely not. The #include statement is evaluated by the preprocessor prior to the compiler being invoked. Clearly, the PC where the preprocessor is running has no idea that there is, somewhere in the universe, an Arduino with an SD shield with an SD card with a file, so, it is NOT possible to include that file.

Sorry when i say call the bitmap what i actually mean is using the drawbitmap function.