#define PROJ_HIRES 0 //1 = high resolution (220x176) , 0 = 110x88 fast mode
#define PROJ_ENABLE_SOUND 1 // 0 = all sound functions disabled
##Program file (bitmap.cpp)
#include "Pokitto.h" // include Pokitto library
#include "pokitto_icon.h" // include the Pokitto icon graphics file
Pokitto::Core mygame; //create Pokitto application instance
int main () {
mygame.begin(); // start the application
mygame.display.load565Palette(pokitto_icon_pal); //load the palette for the image
mygame.display.bgcolor=1; // set color 1 (purple) as background
/* the "while" loop runs as long as the program is running */
while (mygame.isRunning()) {
/* mygame.update() is processed whenever it is time to update the screen */
if (mygame.update()) {
mygame.display.drawBitmap(0,0,pokitto_icon); // draw the pokitto_icon graphic
}
}
return 0; // this is "good programming manners". Program informs it ended without errors
}
mygame.display.bgcolor=1; // set color 1 (purple) as background
But i am i bit confused, i used the mbed site to edit and compile a .bin based of this.(used your link) The color purple was already present at that point. Yet the code for this was not.
Was the background color inside the pokitto lib somehow ? And now you added it to the api ? @jonne
Ok, you dont have to track it down for me
I am just trying to figure out how it all works and this showing up without code for it was really strange.
But i do understand now that in the pokitto lib there is stuff that can do this.
Do i understand correctly that color 1 is the first color in the pallete that is specified ?
Setting it to 0 gives a purple background, 1 also gives a purple background.
Setting 2 gives a nice bleu color(4195). So 0 and 1 seems to pick the first color in the pallete, then 2 picks the next and so on.
No there is nothing wrong. Something is just initialized in different order. I know the palette functions work 100% because Pixonia uses them to the max.
And crucially changing My_settings.h to define PROJ_HIRES as 0:
(The code doesn’t work in hires mode. I don’t know why but I’m sure there’s a rational explanation.)
/**************************************************************************/
/*!
@file My_settings.h
@author XX
@section HOW TO USE My_settings
My_settings can be used to set project settings inside the mbed online IDE
*/
/**************************************************************************/
#ifndef MY_SETTINGS_H
#define MY_SETTINGS_H
#define PROJ_HIRES 0 //1 = high resolution (220x176) , 0 = low resolution fast mode (110x88)
#define PROJ_ENABLE_SOUND 1 // 0 = all sound functions disabled
#endif
If this doesn’t work for you, something else is up.
Note that I’m using Embitz, so there could be some differences if you’re using the online compiler.