[Open] Bugs in Core.menu function


#1

Options not drawing correctly.

[details=Not a bug]While using Core.menu function in simulator if you press b or c button (x and c), program crashing. I don’t know about HW.
It’s not bug. if b or c pressed Core.menu return -1. i missed this in my program[/details]


#2

Please post code, I will fix


#3
#include "Pokitto.h"

Pokitto::Core game;

const char* menuItems[]={"0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19"};
int8_t itemNumber;

int main () {
game.begin();
game.display.loadRGBPalette(paletteCGA);
game.display.setFont(fontAdventurer);
game.display.persistence = true;
while (game.isRunning()) {
    if (game.update()) {
        if(game.buttons.pressed(BTN_A)){
            itemNumber = game.menu(menuItems, 20);
        }
        game.display.color=random(2)+1;
        game.display.setCursor(random(game.display.width),random(game.display.height));
        game.display.print("Hello World! ");
        game.display.print(itemNumber);
    }
}

in this example program not crashing. But still not drawing correctly. I will check my program and if i cannot find (and it finished :grinning:) i will post. I hope i can finish today.


#4

I know the problem is in the library code. The height of the screen is hard-coded in the drawing routine. When I make that variable, the problem will disappear. I have time later today to look at it


#5

It’s not important. If you need to fix/do other things don’t spend your time with this. It can wait :slight_smile:


#6

so i found it’s not bug. I edited first message. Debugging is saving lifes :grinning: