Advice on general approaches or feasibility and discussions about game design
by Valden » Tue Jul 07, 2015 2:49 pm
It seems there is a problem with the
drawBitmap (at least in the beta branch) : if the X position of the image is negative, nothing is displayed at all. At first I thought it wasn't supported (the function would simply return if X < 0), but after a quick look in the function source code, it appears that it should work. See here
https://github.com/Rodot/Gamebuino/blob/beta/libraries/Gamebuino/Display.cpp#L514-538I have a solution for this problem, but it would be better if the function didn't have this bug.
Has anyone encountered the same problem as me ?
-
Valden
-
- Posts: 31
- Joined: Mon Jun 08, 2015 5:33 pm
by rodot » Tue Jul 07, 2015 4:53 pm
Hey,
Can you provide an example ? I just tried and it seems to work fine :
- Code: Select all
#include <SPI.h>
#include <Gamebuino.h>
Gamebuino gb;
//bitmap encoded using the Bitmap Encoder which can be found here : http://gamebuino.com/wiki/index.php?title=Download
const byte pointerBitmap[] PROGMEM = {16,22,0xC,0x0,0x12,0x0,0x12,0x0,0x12,0x0,0x12,0x0,0x13,0x80,0x12,0x70,0x12,0x4C,0x12,0x4A,0xD2,0x49,0xB0,0x9,0x90,0x1,0x90,0x1,0x40,0x1,0x40,0x1,0x20,0x1,0x20,0x2,0x10,0x2,0x10,0x2,0x8,0x4,0x8,0x4,0xF,0xFC,};
void setup(){
gb.begin();
gb.titleScreen(F("Bitmap example"));
}
void loop(){
if(gb.update()){
gb.display.drawBitmap(-3, -3, pointerBitmap);
gb.display.drawBitmap(20, 20, pointerBitmap);
//don't forget to allow the user to get back to the title screen when C is used :
if(gb.buttons.pressed(BTN_C)){
gb.titleScreen(F("Bitmap example"));
}
}
}
-
rodot
- Site Admin
-
- Posts: 1290
- Joined: Mon Nov 19, 2012 11:54 pm
- Location: France
-
by Valden » Tue Jul 07, 2015 5:25 pm
I'm sorry, the bug was on my side
I still don't know why it didn't worked the first time, but now it does.
-
Valden
-
- Posts: 31
- Joined: Mon Jun 08, 2015 5:33 pm
Return to Project Guidance & Game development
Who is online
Users browsing this forum: No registered users and 7 guests