[Solved] Display not working in simulator

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.

OK, I’m on it

Theres a mistake in @Pharap 's PR, I will fix it. Edit: nope, its something else

I was submitting that PR on behalf of @epicdude312.
Somewhat ironic.

Could you try his code? My Win machine is at the workshop and I can’t get GDB to work on the mac

Hey @epicdude312 , could you try https://github.com/pokitto/PokittoSim

with your code? that is the “old” sim

Still not working. Here’s my code:

main.cpp
#include "Pokitto.h"
#include "textures.h"
#define POK_TILEDMODE 0
#define PROJ_HIRES 0
#define PROJ_HICOLOR 0

Pokitto::Core game;

int main () {
    game.begin();
    game.display.width = 110;
    game.display.height = 88;
    game.display.load565Palette(didPalette);
    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,sprite);
                    game.display.bgcolor = 1;
                }
            }
        }
    }

}
Pokitto_settings.h
/**************************************************************************/
/*!
    @file     Pokitto_settings.h
    @author   Jonne Valola

    @section LICENSE

    Software License Agreement (BSD License)

    Copyright (c) 2016, Jonne Valola
    All rights reserved.

    Redistribution and use in source and binary forms, with or without
    modification, are permitted provided that the following conditions are met:
    1. Redistributions of source code must retain the above copyright
    notice, this list of conditions and the following disclaimer.
    2. Redistributions in binary form must reproduce the above copyright
    notice, this list of conditions and the following disclaimer in the
    documentation and/or other materials provided with the distribution.
    3. Neither the name of the copyright holders nor the
    names of its contributors may be used to endorse or promote products
    derived from this software without specific prior written permission.

    THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
    EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
    WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
    DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY
    DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
    (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
    LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
    ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
    (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
    SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/**************************************************************************/


#ifndef POKITTO_SETTINGS_H
#define POKITTO_SETTINGS_H

#include "My_settings.h"

#ifdef PROJ_BOARDREV
 #define POK_BOARDREV PROJ_BOARDREV // which revision of Pokitto board
#else
 #define POK_BOARDREV 2 // default is boardrev 2 (the 4-layer board)
#endif

/** LOGO */
#ifdef PROJ_STARTUPLOGO
 #define POK_DISPLAYLOGO  PROJ_STARTUPLOGO// if enabled, show logo at start
#else
 #define POK_DISPLAYLOGO  1
#endif

#define POK_ENABLE_REFRESHWITHWAIT 0 // choose whether waiting in application refreshes display or not
#define POK_ENABLE_FPSCOUNTER 0 // turn off to save some cpu
#define POK_ENABLE_SD 1 // Define true to include SD library
#define POK_LOADER_COUNTDOWN 3 //how many seconds waiting for C press for loader

#ifndef PROJ_ENABLE_SOUND
    #define POK_ENABLE_SOUND 1
#else
    #define POK_ENABLE_SOUND PROJ_ENABLE_SOUND
#endif

#ifndef PROJ_GBSOUND
    #if POK_ENABLE_SOUND > 0
        #define POK_GBSOUND 0
    #endif
#else
    #define POK_GBSOUND PROJ_GBSOUND
#endif


#ifndef PROJ_STREAMING_MUSIC
    #if POK_ENABLE_SOUND > 0
        #define POK_STREAMING_MUSIC 1 // Define true to stream music from SD
    #endif
#else
    #define POK_STREAMING_MUSIC PROJ_STREAMING_MUSIC
#endif // PROJ_STREAMING_MUSIC

#ifndef PROJ_ENABLE_SYNTH
    #define POK_ENABLE_SYNTH 0
#else
    #define POK_ENABLE_SYNTH PROJ_ENABLE_SYNTH
#endif // PROJ_ENABLE_SYNTH


/** CONSOLE **/
#define POK_USE_CONSOLE 0 //if debugging console is available or not
#define POK_CONSOLE_VISIBLE_AT_STARTUP 1 // whaddaya think ?
#define POK_CONSOLE_INTERVAL 1000 // interval in ms how often console is drawn
#if POK_USE_CONSOLE > 0 // this prevents trying to log messages if console is disabled
    #define POK_CONSOLE_LOG_BUTTONS 0 // if console logs keypresses
    #define POK_CONSOLE_LOG_COLLISIONS 1 // if console logs collisions
#endif // POK_USE_CONSOLE
#define CONSOLEBUFSIZE 20
#define POK_SHOW_VOLUME 0 // volumebar drawn after console if enabled
#define VOLUMEBAR_TIMEOUT 10 // frames before disappearing

/** PROJECT LIBRARY TYPE **/
// Tiled mode can NOT be buffered mode (fast mode, arduboy mode, gamebuino mode etc)
#if PROJ_TILEDMODE > 0
    #define POK_TILEDMODE 1
    #ifdef PROJ_TILEWIDTH
        #define POK_TILE_W PROJ_TILEWIDTH
    #else
        #define POK_TILE_W 11
    #endif // PROJ_TILEWIDTH
    #if POK_TILE_W == 11
        #define POK_TILES_X 20
        #define LCDWIDTH 220
    #elif POK_TILE_W == 12
        #define POK_TILES_X 18
        #define LCDWIDTH 216
    #elif POK_TILE_W == 8
        #define POK_TILES_X 27
        #define LCDWIDTH 216
    #elif POK_TILE_W == 32
        #define POK_TILES_X 6
        #define LCDWIDTH 220
    #elif POK_TILE_W == 10
        #define POK_TILES_X 22
        #define LCDWIDTH 220
    #elif POK_TILE_W == 14
        #define POK_TILES_X 15
        #define LCDWIDTH 210
    #endif
    #ifdef PROJ_TILEHEIGHT
        #define POK_TILE_H PROJ_TILEHEIGHT
    #else
        #define POK_TILE_H 11
    #endif // PROJ_TILEHEIGHT
    #if POK_TILE_H == 11
        #define POK_TILES_Y 16
        #define LCDHEIGHT 176
    #elif POK_TILE_H == 12
        #define POK_TILES_Y 14
        #define LCDHEIGHT 168
    #elif POK_TILE_H == 8
        #define POK_TILES_Y 22
        #define LCDHEIGHT 176
    #elif POK_TILE_H == 32
        #define POK_TILES_Y 5
        #define LCDHEIGHT 176
    #elif POK_TILE_H == 10
        #define POK_TILES_Y 17
        #define LCDHEIGHT 170
    #elif POK_TILE_H == 14
        #define POK_TILES_Y 12
        #define LCDHEIGHT 168
    #endif
#else
#if PROJ_GAMEBUINO > 0
    #define POK_GAMEBUINO_SUPPORT PROJ_GAMEBUINO // Define true to support Gamebuino library calls
    #define PROJ_SCREENMODE MODE_GAMEBUINO_16COLOR
    #define POK_STRETCH 1
    #define PICOPALETTE 0
    #define POK_COLORDEPTH 4
#else
    #if PROJ_ARDUBOY > 0
        #define POK_ARDUBOY_SUPPORT PROJ_ARDUBOY // Define true to support Arduboy library calls
        #define PROJ_SCREENMODE MODE_ARDUBOY_16COLOR
        #define POK_COLORDEPTH 1
        #define POK_STRETCH 1
        #define POK_FPS 20
        #define PICOPALETTE 0
    #else
        #if PROJ_RBOY > 0
            #define PROJ_SCREENMODE MODE_GAMEBUINO_16COLOR
            #define POK_COLORDEPTH 1
            #define POK_STRETCH 0
            #define POK_FPS 40
            #define PICOPALETTE 0
        #else
            #if PROJ_GAMEBOY > 0
            #define PROJ_SCREENMODE MODE_GAMEBOY
            #define POK_COLORDEPTH 2
            #define POK_STRETCH 0
            #define POK_FPS 6
            #define PICOPALETTE 0
            #else
                #define POK_GAMEBUINO_SUPPORT 0
                #define POK_GAMEBOY_SUPPORT 0
                #define POK_ARDUBOY_SUPPORT 0
                #define PICOPALETTE 0
                #define POK_COLORDEPTH 4
            #endif // PROJ_GAMEBOY
        #endif // PROJ_RBOY
    #endif // PROJ_ARDUBOY
#endif // PROJ_GAMEBUINO
#endif // PROJ_TILEDMODE

#if PROJ_MODE13 > 0
    #define PROJ_SCREENMODE MODE13
    #define POK_COLORDEPTH 8
    #define POK_STRETCH 0
    #define POK_FPS 30
    #define POK_COLORDEPTH 8
#endif


/** SCREEN MODES TABLE -- DO NOT CHANGE THESE **/

#define POK_LCD_W 220 //<- do not change !!
#define POK_LCD_H 176 //<- do not change !!

#define MODE_NOBUFFER               0   //Size: 0
#define BUFSIZE_NOBUFFER            0
#define MODE_HI_4COLOR              1   //Size: 9680
#define BUFSIZE_HI_4                9680
#define MODE_FAST_16COLOR           2   //Size: 4840
#define BUFSIZE_FAST_16             4840
#define MODE_HI_16COLOR             3
#define BUFSIZE_HI_16               19360
#define MODE_GAMEBUINO_16COLOR      4   //Size: 2016
#define BUFSIZE_GAMEBUINO_16        2016
#define MODE_ARDUBOY_16COLOR        5   //Size: 4096
#define BUFSIZE_ARDUBOY_16          4096
#define MODE_HI_MONOCHROME          6   //Size: 4840
#define BUFSIZE_HI_MONO             4840
#define MODE_HI_GRAYSCALE           7   //Size: 9680
#define BUFSIZE_HI_GS               9680
#define MODE_GAMEBOY                8
#define BUFSIZE_GAMEBOY             5760
#define MODE_UZEBOX                 9
#define MODE_TVOUT                  10
#define MODE_LAMENES                11
#define BUFSIZE_LAMENES             7680
#define MODE_256_COLOR              12
#define BUFSIZE_MODE_12              4176 // 72 x 58
#define MODE13                      13
#define BUFSIZE_MODE13              9680 // 110*88
// Tiled modes
#define MODE_TILED_1BIT             1001
#define MODE_TILED_8BIT             1002



/** SCREENMODE - USE THIS SELECTION FOR YOUR PROJECT **/

#if POK_TILEDMODE > 1
    #ifndef PROJ_TILEBITDEPTH
        #define PROJ_TILEBITDEPTH 8 //default tiling mode is 256 color mode!
    #endif // PROJ_TILEBITDEPTH
    #if PROJ_TILEBITDEPTH == 1
        #define POK_SCREENMODE MODE_TILED_1BIT
        #define POK_COLORDEPTH 1
    #else
        #define POK_SCREENMODE MODE_TILED_8BIT
        #define POK_COLORDEPTH 8
    #endif // PROJ_TILEBITDEPTH
#else
#ifdef PROJ_SCREENMODE
    #undef POK_COLORDEPTH
    #ifdef PROJ_HIRES
        #if PROJ_HIRES > 1
            #define POK_SCREENMODE MODE_HI_4COLOR
            #undef POK_COLORDEPTH
            #define POK_COLORDEPTH 2
        #elif PROJ_HICOLOR 0
            #define POK_SCREENMODE MODE_256_COLOR
            #undef POK_COLORDEPTH
            #define POK_COLORDEPTH 8
        #else
            #define POK_SCREENMODE MODE_FAST_16COLOR
            #undef POK_COLORDEPTH
            #define POK_COLORDEPTH 4
        #endif // PROJ_HIRES
    #else
        #define POK_SCREENMODE MODE_FAST_16COLOR
        #define POK_COLORDEPTH 4
    #endif // PROJ_HIRES
#else
    #define POK_SCREENMODE PROJ_SCREENMODE
#endif
#endif // POK_TILEDMODE

/* DEFINE SCREENMODE AS THE MAXIMUM SCREEN SIZE NEEDED BY YOUR APP ... SEE SIZES LISTED ABOVE */

/** AUTOMATIC COLOR DEPTH SETTING - DO NOT CHANGE **/
#ifndef POK_COLORDEPTH
    #define POK_COLORDEPTH 4 // 1...5 is valid
#endif // POK_COLORDEPTH

/** AUTOMATIC SCREEN BUFFER SIZE CALCULATION - DO NOT CHANGE **/
#if POK_SCREENMODE == 0
    #define POK_SCREENBUFFERSIZE 0
    #define LCDWIDTH POK_LCD_W
    #define LCDHEIGHT POK_LCD_H
    #define POK_BITFRAME 0
#elif POK_SCREENMODE == MODE_HI_MONOCHROME
    #define POK_SCREENBUFFERSIZE POK_LCD_W*POK_LCD_H*POK_COLORDEPTH/8
    #define LCDWIDTH POK_LCD_W
    #define LCDHEIGHT POK_LCD_H
    #define POK_BITFRAME 4840
#elif POK_SCREENMODE == MODE_HI_16COLOR
    #define POK_SCREENBUFFERSIZE POK_LCD_W*POK_LCD_H/2
    #define LCDWIDTH 220
    #define LCDHEIGHT 176
    #define POK_BITFRAME 4840
#elif POK_SCREENMODE == MODE_HI_4COLOR || POK_SCREENMODE == MODE_HI_GRAYSCALE
    #define POK_SCREENBUFFERSIZE POK_LCD_W*POK_LCD_H*POK_COLORDEPTH/4
    #define LCDWIDTH POK_LCD_W
    #define LCDHEIGHT POK_LCD_H
    #define POK_BITFRAME 4840
#elif POK_SCREENMODE == MODE_FAST_16COLOR
    #define POK_SCREENBUFFERSIZE (POK_LCD_W/2)*(POK_LCD_H/2)*POK_COLORDEPTH/8
    #define XCENTER POK_LCD_W/4
    #define YCENTER POK_LCD_H/4
    #define LCDWIDTH 110
    #define LCDHEIGHT 88
    #define POK_BITFRAME 1210
#elif POK_SCREENMODE == MODE_256_COLOR
    #define POK_SCREENBUFFERSIZE 72*58
    #define XCENTER 36
    #define YCENTER 29
    #define LCDWIDTH 72
    #define LCDHEIGHT 58
    #define POK_BITFRAME 72*58
#elif POK_SCREENMODE == MODE_GAMEBUINO_16COLOR
    #define POK_SCREENBUFFERSIZE (84/2)*(48/2)*POK_COLORDEPTH/8
    #define LCDWIDTH 84
    #define LCDHEIGHT 48
    #define POK_BITFRAME 504
#elif POK_SCREENMODE == MODE_ARDUBOY_16COLOR
    #define POK_SCREENBUFFERSIZE (128/2)*(64/2)*POK_COLORDEPTH/8
    #define LCDWIDTH 128
    #define LCDHEIGHT 64
    #define POK_BITFRAME 1024
#elif POK_SCREENMODE == MODE_LAMENES
    #define POK_SCREENBUFFERSIZE (128)*(120)*POK_COLORDEPTH/8
    #define LCDWIDTH 128
    #define LCDHEIGHT 120
    #define POK_BITFRAME 1210
#elif POK_SCREENMODE == MODE_GAMEBOY
    #define POK_SCREENBUFFERSIZE (160)*(144)/4
    #define LCDWIDTH 160
    #define LCDHEIGHT 144
    #define POK_BITFRAME 2880
#elif POK_SCREENMODE == MODE13
    #define POK_SCREENBUFFERSIZE 110*88
    #define LCDWIDTH 110
    #define LCDHEIGHT 88
    #define POK_BITFRAME 110*88
#else
    #define POK_SCREENBUFFERSIZE 0
#endif // POK_SCREENMODE

#ifndef POK_STRETCH
    #define POK_STRETCH 1 // Stretch Gamebuino display
#endif
#ifndef POK_FPS
    #define POK_FPS 20
#endif
#define POK_FRAMEDURATION 1000/POK_FPS

/** SCROLL TEXT VS. WRAP AROUND WHEN PRINTING **/
#define SCROLL_TEXT 1

/** AUDIO **/
#define POK_AUD_PIN P2_19
#define POK_AUD_PWM_US 31
#define POK_AUD_FREQ 11025 //16000 //14285 //24000 // 14285 // 57143 // 8000 //11025// audio update frequency in Hz
#define POK_CINC_MULTIPLIER 2 // multiplies synth cycle table
#define POK_STREAMFREQ_HALVE  0  // if true, stream update freq is half audio freq
#define POK_STREAM_LOOP 1 //master switch

#define POK_USE_DAC 1 // is DAC in use in this project
#define POK_USE_EXT 0 // if extension port is in use or not
#define POK_STREAM_TO_DAC 1  // 1 = stream from SD to DAC, synthesizer to PWM,  0 = opposite


#define POK_BACKLIGHT_PIN P2_2
#define POK_BACKLIGHT_INITIALVALUE 0.3f

#define POK_BATTERY_PIN1 P0_22 // read battery level through these pins
#define POK_BATTERY_PIN2 P0_23

#define POK_BTN_A_PIN   P1_9
#define POK_BTN_B_PIN   P1_4
#define POK_BTN_C_PIN   P1_10
#define POK_BTN_UP_PIN   P1_13
#define POK_BTN_DOWN_PIN   P1_3
#define POK_BTN_LEFT_PIN   P1_25
#define POK_BTN_RIGHT_PIN   P1_7

#define UPBIT    0
#define DOWNBIT  1
#define LEFTBIT  2
#define RIGHTBIT 3
#define ABIT     4
#define BBIT     5
#define CBIT     6

/** LOADER UPDATE MECHANISM **/
#define POK_ENABLE_LOADER_UPDATES 1 //1=check for new loader versions on SD and update if new found

#ifndef SPRITE_COUNT
#define SPRITE_COUNT 4  // The default max sprite count
#endif

#endif // POKITTO_SETTINGS_H

What I’m getting:

textures.h is the same as before.

This is what I get with a fresh cloned PokittoLib

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,&sprite[1]);
                }
            }
        }
    }

}

and 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

there is an error in the code &sprite[1], look for a better example below:

Another try:

#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()) {
            uint8_t t=0;
            for (char y=0; y<11; y++) {
                for (char x=0; x<13; x++) {
                    t= 1-t;
                    game.display.drawBitmap(x*8,y*8,&spritesheet1[t][0]);
                }
            }
        }
    }

}

@epicdude312 : I think what is happening is simply that you are not setting the graphics mode correctly

@epicdude312 :

Let me explain preprocessor macros to you

This is a preprocessor macro:

#define PROJ_HIRES 0

This, shown below is also a preprocessor macro

##What preprocessor macros do

Preprocessor macros take effect before the code is compiled.

Example:

#define FOOBAR 

#ifdef FOOBAR
game.display.print("Yes FOOBAR!"); // a macro called FOOBAR was found
#else
game.display.print("No FOOBAR!"); // no macro called FOOBAR was found
#endif // ifndef FOO

Now the thing to understand is the scope of how the #define macros are seen by the compiler.

  1. if you have it inside the main.cpp - it is seen only by main.cpp
  2. if you have it in My_settings.h - it is seen by all files that #include "Pokitto.h"
  3. if you have it in Project Build options in CodeBlocks - it is passed on the command line to every .c and .cpp file of the project compiled by the compiler

Do this:

  1. check that PROJ_HIRES and other PROJ_ options are not set in Project Build options in CodeBlocks. It will interfere with My_settings.h
  2. see that you have #define PROJ_HIRES 0 in your My_settings.h
  3. see that the search path of your project is pointing to your directory (where your My_settings.h is) instead of another place. See below. You do not want your project reading the My_settings.h of another target (for example the HelloWorld target)

2 Likes

It’s working now! Thanks!

Hopefully I’ll be able to make my game in time :smiley:

Good luck!!!

1 Like

Welp, another major bug appeared. I discovered this earlier because it affected my ability to develop Blocky World. Essentially, if I have a for loop with an array assignment in it, it crashes the simulator. So I guess I can’t develop for the Pokitto until it’s fixed, because I use for loops with array assignments in a lot of my projects. I decided to drop out of LD, but I think this needs to be fixed ASAP…

Could you show us the code?

That sounds like the code is trying to write to memory it shouldn’t.

The simulator is running directly on your computer, it’s not emulating the Pokitto’s instruction set so if array assignment is crashing in the simulator, it’s code that would crash on your computer anyway, which implies there’s something wrong with the code, not the simulator.

for (char h=0; h<11; y++) {
        for (char k=0; k<13; k++) {
            tilesOtherScreen[k][h] = 1;
        }
    }

y++ should be h++ in the first line.

for (char h=0; h<11; y++) {

should be

for (char h=0; h<11; h++) {

2 Likes