This is a basic example how to draw a bitmap on Pokitto screen
Dependencies: PokittoLib
Pokitto drawBitmap basic example
The bitmap was created with Photoshop (but you can use any similar drawing program) and converted to a .h resource file using Filippos img2pok tool, available here: https://github.com/Effer/img2pok
To try it out yourself
Just press the "Import into compiler" button on top right of this page!
bitmap.cpp@0:9783d85b2a06, 2018-01-01 (annotated)
- Committer:
- Pokitto
- Date:
- Mon Jan 01 10:22:35 2018 +0000
- Revision:
- 0:9783d85b2a06
- Child:
- 2:5ef3dd229260
Initial commit
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Pokitto | 0:9783d85b2a06 | 1 | /* Pokitto drawBitmap example - draws a Pokitto icon by @trelemar */ |
Pokitto | 0:9783d85b2a06 | 2 | |
Pokitto | 0:9783d85b2a06 | 3 | #include "Pokitto.h" // include Pokitto library |
Pokitto | 0:9783d85b2a06 | 4 | #include "pokitto_icon.h" // include the Pokitto icon graphics file |
Pokitto | 0:9783d85b2a06 | 5 | |
Pokitto | 0:9783d85b2a06 | 6 | Pokitto::Core mygame; //create Pokitto application instance |
Pokitto | 0:9783d85b2a06 | 7 | |
Pokitto | 0:9783d85b2a06 | 8 | int main () { |
Pokitto | 0:9783d85b2a06 | 9 | mygame.begin(); // start the application |
Pokitto | 0:9783d85b2a06 | 10 | mygame.display.load565Palette(pokitto_icon_pal); //load the palette for the image |
Pokitto | 0:9783d85b2a06 | 11 | /* the "while" loop runs as long as the program is running */ |
Pokitto | 0:9783d85b2a06 | 12 | while (mygame.isRunning()) { |
Pokitto | 0:9783d85b2a06 | 13 | /* mygame.update() is processed whenever it is time to update the screen */ |
Pokitto | 0:9783d85b2a06 | 14 | if (mygame.update()) { |
Pokitto | 0:9783d85b2a06 | 15 | mygame.display.drawBitmap(0,0,pokitto_icon); // draw the pokitto_icon graphic |
Pokitto | 0:9783d85b2a06 | 16 | } |
Pokitto | 0:9783d85b2a06 | 17 | } |
Pokitto | 0:9783d85b2a06 | 18 | |
Pokitto | 0:9783d85b2a06 | 19 | return 0; // this is "good programming manners". Program informs it ended without errors |
Pokitto | 0:9783d85b2a06 | 20 | } |
Pokitto | 0:9783d85b2a06 | 21 |