NEW 6 years ago
Do you know what the upper size of the bitmap can be? If I make it really small it works, but over a certain size it just shows as a black box. I haven't quite narrowed down the size that breaks.
NEW 6 years ago
ca change quoi?
Sorunome
6 years ago
Indexed images use a palette, by default the gamebuino palette. They are smaller in size.
RGB565 images are basically full color.
NEW 6 years ago
Indexed images use a palette, by default the gamebuino palette. They are smaller in size.
RGB565 images are basically full color.
Adamko
6 years ago
c moi dit:
# include <Gamebuino-Meta.h>
const uint8_t myImgBuf [] = {
8, 8, // largeur, hauteur
1, 0, // frames
0, // boucle d'image
0xFF, // couleur transparente
1, // Mode couleur
0x07, 0x07, 0x07, 0x07,
0x70, 0x70, 0x70, 0x70,
0x07, 0x07, 0x07, 0x07,
0x70, 0x70, 0x70, 0x70,
0x07, 0x07, 0x07, 0x07,
0x70, 0x70, 0x70, 0x70,
0x07, 0x07, 0x07, 0x07,
0x70, 0x70, 0x70, 0x70,
}
Image myImg (myImgBuf); sur cette ligne ca me dit "expected ',' or ';' before 'Image'"
void setup () {
gb.begin ();
}
void loop () {
while (! gb.update ());
gb.display.clear (RED);
// dessine l'image
gb.display.drawImage (10, 10, myImg);
}
NEW 6 years ago
c moi dit:
# include <Gamebuino-Meta.h>
const uint8_t myImgBuf [] = {
8, 8, // largeur, hauteur
1, 0, // frames
0, // boucle d'image
0xFF, // couleur transparente
1, // Mode couleur
0x07, 0x07, 0x07, 0x07,
0x70, 0x70, 0x70, 0x70,
0x07, 0x07, 0x07, 0x07,
0x70, 0x70, 0x70, 0x70,
0x07, 0x07, 0x07, 0x07,
0x70, 0x70, 0x70, 0x70,
0x07, 0x07, 0x07, 0x07,
0x70, 0x70, 0x70, 0x70,
}
Image myImg (myImgBuf); sur cette ligne ca me dit "expected ',' or ';' before 'Image'"
void setup () {
gb.begin ();
}
void loop () {
while (! gb.update ());
gb.display.clear (RED);
// dessine l'image
gb.display.drawImage (10, 10, myImg);
}
clement
6 years ago
C est parcequ il manque un ; juste avant Image ;)
const uint8_t myImgBuf [] = { 8, 8, // largeur, hauteur 1, 0, // frames 0, // boucle d'image 0xFF, // couleur transparente 1, // Mode couleur 0x07, 0x07, 0x07, 0x07, 0x70, 0x70, 0x70, 0x70, 0x07, 0x07, 0x07, 0x07, 0x70, 0x70, 0x70, 0x70, 0x07, 0x07, 0x07, 0x07, 0x70, 0x70, 0x70, 0x70, 0x07, 0x07, 0x07, 0x07, 0x70, 0x70, 0x70, 0x70, } ; //<<<<<<<<<<<<<<<<<<<<<--------------- celui la de point virgule
Il faut bien lire les messages d erreurs souvent ils aident bien :)
++
NEW 6 years ago
C est parcequ il manque un ; juste avant Image ;)
const uint8_t myImgBuf [] = { 8, 8, // largeur, hauteur 1, 0, // frames 0, // boucle d'image 0xFF, // couleur transparente 1, // Mode couleur 0x07, 0x07, 0x07, 0x07, 0x70, 0x70, 0x70, 0x70, 0x07, 0x07, 0x07, 0x07, 0x70, 0x70, 0x70, 0x70, 0x07, 0x07, 0x07, 0x07, 0x70, 0x70, 0x70, 0x70, 0x07, 0x07, 0x07, 0x07, 0x70, 0x70, 0x70, 0x70, } ; //<<<<<<<<<<<<<<<<<<<<<--------------- celui la de point virgule
Il faut bien lire les messages d erreurs souvent ils aident bien :)
++
NEW 6 years ago
ca fonctionne super bien. merci. je suis allé jeter un coup d'oueil a save the princess
NEW 6 years ago
Is there a way to delete the images in ram (when i no more need them)
Sorunome
6 years ago
If the image object is deleted then the associated ram buffer is deleted, too.
Deletion of that happens e.g. if they are scoped locally or with the delete
keyword, in case of pointers
void someFunc() { Image img(/* blah *); // do stuff // image gets deleted as it is end of the function }
Image* img_ptr;void init() { img_ptr = new Image(/* stuff */); } // later on in your code delete img_ptr;
Please note that that can easily cause ram fragmentation