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@3:401b951fdcdc, 2018-05-02 (annotated)
- Committer:
- Pokitto
- Date:
- Wed May 02 06:22:13 2018 +0000
- Revision:
- 3:401b951fdcdc
- Parent:
- 2:5ef3dd229260
New pokittolib with improved volume controls & better button handling
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 | 2:5ef3dd229260 | 11 | mygame.display.bgcolor=0; |
Pokitto | 0:9783d85b2a06 | 12 | /* the "while" loop runs as long as the program is running */ |
Pokitto | 0:9783d85b2a06 | 13 | while (mygame.isRunning()) { |
Pokitto | 0:9783d85b2a06 | 14 | /* mygame.update() is processed whenever it is time to update the screen */ |
Pokitto | 0:9783d85b2a06 | 15 | if (mygame.update()) { |
Pokitto | 0:9783d85b2a06 | 16 | mygame.display.drawBitmap(0,0,pokitto_icon); // draw the pokitto_icon graphic |
Pokitto | 0:9783d85b2a06 | 17 | } |
Pokitto | 0:9783d85b2a06 | 18 | } |
Pokitto | 0:9783d85b2a06 | 19 | |
Pokitto | 0:9783d85b2a06 | 20 | return 0; // this is "good programming manners". Program informs it ended without errors |
Pokitto | 0:9783d85b2a06 | 21 | } |
Pokitto | 0:9783d85b2a06 | 22 |