NEW il y a 6 ans
Hello when I tried to dispay this little png (a man) I used the magenta color for transparancy but I my image is not correctly. I used index color palette. But with rgb565 it works well. Why ?
My original png
#include <Gamebuino-Meta.h> const int8_t manData[] = {7, 17, 1, 0, 1, 0xee, 1, 0x00, 0x00,0x00, 0xef,0xff, 0xff,0xfe, 0xf0,0xff, 0x0f,0xef, 0x0f,0xf0, 0xfe,0xff, 0xff,0xff, 0xef,0xff, 0xff,0xfe, 0xee,0x77, 0x7e,0xef, 0x11,0x11, 0x1f,0xf7, 0x77,0x77, 0xff,0x11, 0x11,0x1f, 0xf7,0x77, 0x77,0xff, 0x11,0x11, 0x1f,0xfc, 0xcc,0xcc, 0xfe,0xcc, 0xcc,0xce, 0xec,0xce, 0xcc,0xee, 0x00,0xe0, 0x0e,0xe0, 0x0e,0xe000}; Image man = Image(manData); void setup() { gb.begin(); } void loop() { while(!gb.update()); gb.display.clear(); // now we can draw the image to the display, at x=0 and y=0 gb.display.drawImage(0, 0, man); }
the result with index color
Aurélien Rodot
il y a 6 ans
Look like you have an odd with, can you make it 8 pixels wide ?
As Sorunome said earlier :
I'm sorry to say that the tool you linked has a bug with indexed images having an odd width! Try making your image one pixel wider, so that it is 26 pixels wide, put it through the tool, and then in the output image header change the width back to 25
NEW il y a 6 ans
Look like you have an odd with, can you make it 8 pixels wide ?
As Sorunome said earlier :
I'm sorry to say that the tool you linked has a bug with indexed images having an odd width! Try making your image one pixel wider, so that it is 26 pixels wide, put it through the tool, and then in the output image header change the width back to 25
NEW il y a 6 ans
Hmm I have one question - I tried to set my own custom color palette. But when i try use this function:
gb.display.setPalette(myPalette);
I get error message - 'class Gamebuino_Meta::Image' has no member named 'setPalette'
Why i get such message ? :<
NEW il y a 6 ans
Hmm I have one question - I tried to set my own custom color palette. But when i try use this function:
gb.display.setPalette(myPalette);
I get error message - 'class Gamebuino_Meta::Image' has no member named 'setPalette'
Why i get such message ? :<
NEW il y a 6 ans
That function only exists in the git version currently, it didn't get pushed as update to the normal arduino library manager thing yet. You are always free to manually install the git repository
NEW il y a 6 ans
Hi, I think I'm hitting the upper limit for an integer array trying to create a tilemap. I have 50 tiles at 16x16 that I want to pick from. It worked when I only had 25 tiles.
The Arduino IDE just doesn't compile it, and through Visual Studio it compiles but then I get a crash when it loads onto the Gambuino.
Any suggestions? I'm currently not using indexed (I don't understand it 100%..) so I could try that but I think I will run out again once I create a few more tiles...
The other thing I could do is create a few separate tilemaps but I need to work out how to point each "Tile" to the correct image. (I haven't worked with pointers since high-school... 20 years ago). Or would there be significant overhead building the Image inside the draw function each time?
NEW il y a 6 ans
First question - do You really need int for tilemap ? Couldn't it be something smaller like char ?
NEW il y a 6 ans
What do you mean "it just doesn't compile"? What are the errors?
Reuben uses images as tilemaps and it uses like 400 unique tiles, it should work in theory with up to 65535 different tiles.
strangenikolai
il y a 6 ans
I have a file called tiles.ino which has the following code (this is my test code to narrow down the issue so it just drawa 1 tile)
const uint16_t tilesetData[] = {16,16, 51, 0, 0xffff, 0, 0x3388,0x3388,0x3388,0x3388,0x3388,0x3388,0x3388,0x3388 }; Image tileset = Image(tilesetData); void drawTiles(){ tileset.setFrame(1); gb.display.drawImage(16, 16, tileset); }
I generated the tilesetData[] from the Image to Code Converter. When I had 25 tile this worked fine. Once I added more to the tileset image (and re-ran through the converter) I got an error trying to call drawTiles().
drawTiles() is not defined in this scope.
My tiles are 16 x 16 pixels (too big probably) and when I found the page below I thought I had too many elements - as 51*16*16 = 13,056 and I guessed that uint16_t would be bigger than the int listed here.
http://arduino.land/FAQ/content/6/7/en/what-is-the-maximum-number-of-elements-an-array-can-have.html
NEW il y a 6 ans
I have a file called tiles.ino which has the following code (this is my test code to narrow down the issue so it just drawa 1 tile)
const uint16_t tilesetData[] = {16,16, 51, 0, 0xffff, 0, 0x3388,0x3388,0x3388,0x3388,0x3388,0x3388,0x3388,0x3388 }; Image tileset = Image(tilesetData); void drawTiles(){ tileset.setFrame(1); gb.display.drawImage(16, 16, tileset); }
I generated the tilesetData[] from the Image to Code Converter. When I had 25 tile this worked fine. Once I added more to the tileset image (and re-ran through the converter) I got an error trying to call drawTiles().
drawTiles() is not defined in this scope.
My tiles are 16 x 16 pixels (too big probably) and when I found the page below I thought I had too many elements - as 51*16*16 = 13,056 and I guessed that uint16_t would be bigger than the int listed here.
http://arduino.land/FAQ/content/6/7/en/what-is-the-maximum-number-of-elements-an-array-can-have.html
strangenikolai
il y a 6 ans
Ok - I think it might just be an issue with the Arduino IDE and long lines of text. I've worked out what my issue was with Visual Studio (I had in in Debug mode, Release mode works ok) and it seems to work now. Sorry for the red herring.
Also, I've made a change to consider for the Image to Code Converter but will go post there...
NEW il y a 6 ans
Ok - I think it might just be an issue with the Arduino IDE and long lines of text. I've worked out what my issue was with Visual Studio (I had in in Debug mode, Release mode works ok) and it seems to work now. Sorry for the red herring.
Also, I've made a change to consider for the Image to Code Converter but will go post there...
NEW il y a 6 ans
Hello again,
I can't work out what I'm doing wrong trying to load a bitmap. Below is my code, backg.bmp is in the same folder as the .ino. It doesn't error, it just doesn't display.
#include <Gamebuino-Meta.h> Image bg("backg.bmp"); void setup() { gb.begin(); } void loop() { while(!gb.update()); gb.display.clear(); gb.display.drawImage(1,1,bg); }
NEW il y a 6 ans
the file needs to be on the SD card, in the folder of the name of your sketch