Mode15 demo program (220x176x16 colors)
Dependencies: PokittoLib
Mode15.cpp
00001 /* Pokitto drawBitmap example - draws a Pokitto icon by @trelemar */ 00002 00003 #include "Pokitto.h" // include Pokitto library 00004 #include "monkey16.h" 00005 00006 Pokitto::Core mygame; //create Pokitto application instance 00007 00008 void drawBlurb(const char* text, int x, int y, uint8_t fc, uint8_t bgc) { 00009 for (int tx=-1;tx<2;tx++) { 00010 for (int ty=-1;ty<2;ty++) { 00011 mygame.display.setColor(bgc,15); 00012 mygame.display.setInvisibleColor(15); 00013 mygame.display.setCursor(x+tx,y+ty); 00014 mygame.display.print(text); 00015 } 00016 } 00017 mygame.display.setCursor(x,y); 00018 mygame.display.setColor(fc,bgc); 00019 mygame.display.setInvisibleColor(bgc); 00020 mygame.display.print(text); 00021 } 00022 00023 00024 int main () { 00025 int x=0,y=20; 00026 mygame.begin(); // start the application 00027 mygame.display.load565Palette(monkey16_pal); //load the palette for the image 00028 mygame.display.setColor(1,0); // set foreground and background colors from palette 00029 mygame.display.setFont(fontMonkey); // choose a lovely font 00030 mygame.display.setInvisibleColor(0); 00031 /* the "while" loop runs as long as the program is running */ 00032 while (mygame.isRunning()) { 00033 /* mygame.update() is processed whenever it is time to update the screen */ 00034 if (mygame.update()) { 00035 x-=2; 00036 if (x<-90) x=-90; 00037 else if (x>0) x = 0; 00038 mygame.display.drawBitmap(x,16,monkey161); 00039 mygame.display.drawBitmap(x+160,16,monkey162); 00040 if (x<-82) { 00041 drawBlurb("The New Mode15!!",10,62,14,0); 00042 } 00043 if (x<-88) { 00044 drawBlurb("Nice!",130,82,10,0); 00045 } 00046 00047 } 00048 } 00049 return 0; // this is "good programming manners". Program informs it ended without errors 00050 } 00051
Generated on Wed Jul 20 2022 11:26:00 by
