/* ************************************** * Includes * * **************************************/ #include "Menu.h" #include "HumanPlayer.h" #include "Game.h" #include "System.h" #include #include /* ************************************** * Defines * * **************************************/ #define GAME_NAME "Pocket Empires" /* ************************************** * Structs and enums * * **************************************/ /* ************************************** * Local variables * * **************************************/ /* ************************************** * Functions definition * * **************************************/ /*****************************************************************//** * * \brief Video game entry point. Main menu is shown, allowing * the user to choose an option. * *********************************************************************/ void MainMenu(void) { enum { CHOICE_SINGLE_PLAYER_GAME, CHOICE_MULTI_PLAYER_GAME, CHOICE_OPTIONS, MAX_CHOICES }; static const char strMainMenuOptions_0[] PROGMEM = "Single player game"; static const char strMainMenuOptions_1[] PROGMEM = "Multiplayer game"; static const char strMainMenuOptions_2[] PROGMEM = "Options"; static const char* const astrMainMenuOptions[MAX_CHOICES] PROGMEM = { [CHOICE_SINGLE_PLAYER_GAME] = strMainMenuOptions_0, [CHOICE_MULTI_PLAYER_GAME] = strMainMenuOptions_1, [CHOICE_OPTIONS] = strMainMenuOptions_2 }; /* Show video game name on * Gamebuino default title screen. */ gb.titleScreen(F(GAME_NAME)); /* Choose which module should be * executed depending on user input. */ switch (gb.menu(astrMainMenuOptions, MAX_CHOICES)) { case CHOICE_SINGLE_PLAYER_GAME: { enum { /* Maximum number of characters for * player name, as specified on * Gamebuino documentation. */ GAMEBUINO_MAX_PLAYER_NAME = 10 }; char strName[GAMEBUINO_MAX_PLAYER_NAME] = {0}; /* Fill strName with default user name. */ gb.getDefaultName(strName); /* Declare 1 human player instance. */ HumanPlayer h(strName); const struct tGameConfig c = { .pHumanPlayerData = &h, .u8NHumanPlayers = 1 }; /* Initialize game with defined configuration. */ Game(c); } break; case CHOICE_MULTI_PLAYER_GAME: /* Not implemented yet. Fall through. */ case CHOICE_OPTIONS: /* Not implemented yet. Fall through. */ default: /* Undefined choice. Exit. */ break; } }