Registration has been disabled due to spam bots. If you would like an account please email forum AT with your desired username and email.

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
I can't understand your code... :(
(11-26-2014, 02:12 PM)Sinan Wrote: Okay thanks for the quick awnser! Smile You mean that I can code my own game as .h and .cpp and it would show it in the menu or do I have to define it in the menu.cpp? (I dont mean define it as headers but do i have to write the game functions in the menu.cpp?)

Yeah almost. In menus/games.c change OPTION_COUNT to 3 and add this line into the itemLoader function:
setMenuOption_P(2, PSTR("your game name"), NULL, yourgame_start);

Looking at the games in games/ folder, the main function you will need is yourgame_start(), which is called when you select the menu option. In that function you should close the menu and set the draw and button functions:

void yourgame_start()

    buttons_setFuncs(btnRight, btnExit, btnLeft);

static bool btnExit()
    animation_start(display_load, ANIM_MOVE_OFF);
    return true;

static bool btnRight()

    return false;

static bool btnLeft()

    return false;

static display_t draw()
// main game code here

    return DISPLAY_BUSY;

The button functions should return true so the the function is not called again until next button press or false to continually call the function while the button is pressed. draw() should always return DISPLAY_BUSY.

Messages In This Thread
I can't understand your code... :( - by Sinan - 11-25-2014, 07:58 PM
RE: I can't understand your code... :( - by Zak - 11-25-2014, 09:57 PM
RE: I can't understand your code... :( - by Sinan - 11-26-2014, 02:12 PM
RE: I can't understand your code... :( - by Zak - 11-27-2014, 08:34 PM

Forum Jump:

Users browsing this thread: 1 Guest(s)