Myndale wrote:82ns
Under 100 ns. Fantastic, I knew you could do it !
Myndale wrote:82ns
Myndale wrote:82ns
class Bitmap{
public :
uint8_t width;
uint8_t height;
uint8_t numColors; //number of indexed colors
static uint8_t colorIndex[] = [WHITE, BLACK, GRAY, TRANSPARENT, INVERT];
//the colors are constants respectively equal to 0 1 2 3 4
//gray will be automatically filled by an alternating checkers pattern by gb.display.drawBitmap()
uint8_t frames; //number of frames stored. Can be used for animated bitmaps or tilemaps
uint8_t compression; //0 for raw bitmap, 1 for RLE, 2 for nokia swizzled...
uint8_t location; //either 0 for PROGMEM or 1 for RAM (why not SD card support later on)
const uint8_t *bitmap; //a pointer to the bitmap data array.
//Contains all the different colors, and one or several frames one after the other
//the duration of each frame is store right before the pixels data
void loadPROGMEM(const uint8_t *bmp){
location = 0; //bitmap located in progmem
width = pgm_read_byte(bmp);
height = pgm_read_byte(bmp + 1);
colors = pgm_read_byte(bmp + 2);
frames = pgm_read_byte(bmp + 3);
compression = pgm_read_byte(bmp + 4);
bitmap = bmp + 5;
}
void loadRAM(const uint8_t *bmp){
location = 1; //bitmap located in RAM
width = bmp[0];
height = bmp[1];
colors = bmp[2];
frames = bmp[3];
compression = bmp[4];
bitmap = bmp + 5;
}
};
class AnimatedBitmap{
Bitmap *bitmap;
int8_t currentFrame; //-1 when not playing
uint8_t looping; //0 no looping, 1 normal looping, 2 back and forth loopming, 3 stay on the last frame, etc.
}
Return to Software Development
Users browsing this forum: No registered users and 4 guests