il y a 4 ans
For the game I'm developing I need to display images in 1 colour and be able to change their colour. I was thinking creating an image class with a width, height, colour, and bool array for the pixels where false means transparent, and then create a method to draw the image pixel by pixel, but I wondered if that's not using too much CPU. Before I start I wanted to know if there's a simpler or more efficient way to achieve the same result, or if I'm on the right track?
NEW il y a 4 ans
If you're not short on flash memory, the simplest way might be to use the library's 8bit indexed mode and restrict yourself to 1 color. Alternatively, you could save lots of memory by using a single bit per pixel instead the full bool type. and use bit shifts + masking to get an individual pixel's value. This should be fast enough, the library draw functions also just go over the image pixel by pixel.
Edit: My bad, I missed deeph's post!