/** * Copyright (c) 2024 Dominic Masters * * This software is released under the MIT License. * https://opensource.org/licenses/MIT */ #include "mainmenu.h" #include "game/game.h" #include "locale/language.h" menu_t MAIN_MENU; void mainMenuInit() { const char_t* strings[] = { languageGetPointer("main_menu.new_game"), languageGetPointer("main_menu.load_game"), languageGetPointer("main_menu.options"), languageGetPointer("main_menu.exit") }; uint16_t columns = 1; uint16_t rows = 4; menuInit(&MAIN_MENU, columns, rows); memcpy(MAIN_MENU.strings, strings, sizeof(strings)); MAIN_MENU.selectCallback = mainMenuSelectCallback; } void mainMenuUpdate() { menuUpdate(&MAIN_MENU); } void mainMenuSelectCallback( const menu_t *menu, const uint16_t x, const uint16_t y, const char_t *str ) { // New Game if(y == 0) { GAME.mapNext = MAP_LIST_TRAIN_STATION; GAME.state = GAME_STATE_MAP_CHANGE; return; } // Load Game if(y == 1) { return; } // Options if(y == 2) { return; } // Exit if(y == 3) { GAME.shouldExit = true; return; } }