I was about to start coding my game, but I discovered that whenever I draw a bitmap (direct or buffered) in the simulator, the entire screen is just color 0.
Here’s my code:
main.cpp
#include "Pokitto.h"
#include "textures.h"
Pokitto::Core game;
int main () {
game.begin();
game.display.load565Palette(palette);
game.display.invisiblecolor = 0;
while (game.isRunning()) {
if (game.update()) {
for (char y=0; y<11; y++) {
for (char x=0; x<13; x++) {
game.display.drawBitmap(x*8,y*8,sprites[1]);
}
}
}
}
}
[details=My_settings.h]```
/**************************************************************************/
/*!
@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
[details=textures.h]
#include <stdint.h>
#ifndef TEXTURES_H_INCLUDED
#define TEXTURES_H_INCLUDED
//Total colors 16
const uint16_t palette[] = {
63519,1066,65437,1834,0,43654,63497,11647,6474,23209,64768,64437,31018,50712,65412,65141,
};
const uint8_t sprite[] = {
8,8,
51,51,51,51,
51,51,51,51,
51,51,51,51,
51,51,51,51,
51,51,51,51,
51,51,51,51,
51,51,51,51,
51,51,51,51,
};
//Sprite sheet:4x7
const uint8_t spritesheet1 [][34] ={
//[0] cell:0x0
{
8,8,
51,51,51,51,
51,51,51,51,
51,51,51,51,
51,51,51,51,
51,51,51,51,
51,51,51,51,
51,51,51,51,
51,51,51,51,
},
//[1] cell:1x0
{
8,8,
51,51,51,51,
49,51,51,51,
49,51,51,19,
51,49,51,19,
51,49,51,51,
49,51,49,51,
49,51,49,51,
51,51,51,51,
},
//[2] cell:2x0
{
8,8,
17,17,17,17,
17,17,17,17,
17,17,17,17,
17,17,17,17,
17,17,17,17,
17,17,17,17,
17,17,17,17,
17,17,17,17,
},
//[3] cell:3x0
{
8,8,
17,17,17,17,
20,17,17,17,
20,17,17,65,
17,20,17,65,
17,20,17,17,
20,17,20,17,
20,17,20,17,
17,17,17,17,
},
//[4] cell:0x1
{
8,8,
51,51,51,51,
51,51,51,51,
49,51,51,19,
49,51,51,19,
51,51,51,51,
51,51,19,51,
51,51,19,51,
51,51,51,51,
},
//[5] cell:1x1
{
8,8,
51,51,51,51,
51,51,51,51,
51,51,51,51,
51,51,51,51,
49,51,51,19,
49,51,19,19,
51,51,19,51,
51,51,51,51,
},
//[6] cell:2x1
{
8,8,
17,17,17,17,
17,17,17,17,
20,17,17,65,
20,17,17,65,
17,17,17,17,
17,17,65,17,
17,17,65,17,
17,17,17,17,
},
//[7] cell:3x1
{
8,8,
17,17,17,17,
17,17,17,17,
17,17,17,17,
17,17,17,17,
20,17,17,65,
20,17,65,65,
17,17,65,17,
17,17,17,17,
},
//[8] cell:0x2
{
8,8,
51,51,51,51,
51,51,51,51,
51,51,62,51,
51,51,49,51,
51,51,51,51,
51,99,51,51,
51,19,51,51,
51,51,51,51,
},
//[9] cell:1x2
{
8,8,
51,51,51,51,
51,51,51,51,
51,51,51,51,
51,51,51,51,
51,50,51,51,
51,49,51,51,
51,51,51,51,
51,51,51,51,
},
//[10] cell:2x2
{
8,8,
17,17,17,17,
17,17,17,17,
17,17,26,17,
17,17,20,17,
17,17,17,17,
17,193,17,17,
17,65,17,17,
17,17,17,17,
},
//[11] cell:3x2
{
8,8,
17,17,17,17,
17,17,17,17,
17,17,17,17,
17,17,17,17,
17,29,17,17,
17,20,17,17,
17,17,17,17,
17,17,17,17,
},
//[12] cell:0x3
{
8,8,
51,51,51,51,
51,51,51,51,
51,115,51,51,
51,19,51,51,
51,51,51,51,
51,51,50,51,
51,51,49,51,
51,51,51,51,
},
//[13] cell:1x3
{
8,8,
51,51,51,51,
59,51,51,51,
49,51,51,115,
51,51,51,19,
51,51,99,51,
51,51,19,51,
51,51,51,51,
51,51,51,51,
},
//[14] cell:2x3
{
8,8,
17,17,17,17,
17,17,17,17,
17,129,17,17,
17,65,17,17,
17,17,17,17,
17,17,29,17,
17,17,20,17,
17,17,17,17,
},
//[15] cell:3x3
{
8,8,
17,17,17,17,
22,17,17,17,
20,17,17,129,
17,17,17,65,
17,17,193,17,
17,17,65,17,
17,17,17,17,
17,17,17,17,
},
//[16] cell:0x4
{
8,8,
51,51,17,51,
51,49,49,57,
51,49,49,147,
51,51,51,49,
57,147,19,19,
51,147,51,147,
147,25,147,51,
153,49,17,19,
},
//[17] cell:1x4
{
8,8,
49,17,51,51,
19,19,19,51,
19,49,19,51,
147,19,49,51,
49,145,147,51,
19,147,51,19,
57,57,25,49,
145,17,19,57,
},
//[18] cell:2x4
{
8,8,
17,17,153,17,
17,25,25,20,
17,25,25,65,
17,17,17,25,
20,65,145,145,
17,65,17,65,
65,148,65,17,
68,25,153,145,
},
//[19] cell:3x4
{
8,8,
25,153,17,17,
145,145,145,17,
145,25,145,17,
65,145,25,17,
25,73,65,17,
145,65,17,145,
20,20,148,25,
73,153,145,20,
},
//[20] cell:0x5
{
8,8,
57,51,51,17,
51,17,147,147,
51,145,17,153,
51,57,145,17,
51,51,57,25,
51,51,51,69,
51,51,51,52,
51,51,51,51,
},
//[21] cell:1x5
{
8,8,
147,57,57,25,
17,57,17,147,
17,145,25,51,
25,25,147,51,
25,147,51,51,
84,51,51,51,
67,51,51,51,
51,51,51,51,
},
//[22] cell:2x5
{
8,8,
20,17,17,153,
17,153,65,65,
17,73,153,68,
17,20,73,153,
17,17,20,148,
17,17,17,73,
17,17,17,20,
17,17,17,17,
},
//[23] cell:3x5
{
8,8,
65,20,20,148,
153,20,153,65,
153,73,148,17,
148,148,65,17,
148,65,17,17,
148,17,17,17,
65,17,17,17,
17,17,17,17,
},
//[24] cell:0x6
{
8,8,
51,25,51,51,
51,49,51,19,
51,51,51,51,
145,19,17,57,
49,51,25,19,
57,17,153,51,
51,53,67,51,
51,51,51,51,
},
//[25] cell:1x6
{
8,8,
17,148,17,17,
17,25,17,145,
17,17,17,17,
73,145,153,20,
25,17,148,145,
20,153,68,17,
17,25,65,17,
17,17,17,17,
},
//[26] cell:2x6
{
8,8,
0,12,192,0,
0,198,204,0,
0,194,108,0,
12,98,204,192,
12,102,108,192,
0,198,204,0,
0,198,108,0,
0,12,192,0,
},
//[27] cell:3x6
{
8,8,
238,238,238,238,
229,94,229,94,
229,94,229,94,
170,169,90,170,
165,154,165,154,
169,89,89,90,
165,149,149,154,
170,170,170,170,
},
};
#endif // TEXTURES_H_INCLUDED
[/details]
I need this fixed ASAP so I can participate in Ludum Dare.
EDIT: Apparently the hide details function is incredibly buggy. Oh well.