diff --git a/source/game.cpp b/source/game.cpp index f01b25c..44836ef 100644 --- a/source/game.cpp +++ b/source/game.cpp @@ -27,7 +27,7 @@ Game::Game(SDL_Renderer *renderer, Screen *screen, Asset *asset, Input *input) section.subsection = SUBSECTION_GAME_PLAY; musicEnabled = true; - debug = true; + debug = false; musicEnabled = !debug; } diff --git a/source/prog.cpp b/source/prog.cpp index c25ab97..3440797 100644 --- a/source/prog.cpp +++ b/source/prog.cpp @@ -26,7 +26,7 @@ Prog::Prog(std::string executablePath) } else { - section.name = SECTION_PROG_GAME; + section.name = SECTION_PROG_LOGO; } input = new Input(asset->get("gamecontrollerdb.txt")); screen = new Screen(window, renderer, options); diff --git a/source/title.cpp b/source/title.cpp index d8c35c1..034e5ca 100644 --- a/source/title.cpp +++ b/source/title.cpp @@ -46,7 +46,7 @@ Title::~Title() delete text; text = nullptr; - + delete text2; text2 = nullptr; @@ -64,9 +64,9 @@ void Title::initMenu() menu->loadAudioFile(asset->get("sound_menu_move.wav"), SOUND_MOVE); menu->init("TITLE", 0, 150, MENU_BACKGROUND_TRANSPARENT); - menu->addItem("START",2); + menu->addItem("START", 2); menu->addItem("OPTIONS", 5); - menu->addItem("EXIT"); + menu->addItem("EXIT"); menu->setDefaultActionWhenCancel(2); menu->setBackgroundColor({0x30, 0x30, 0x40}, 192); menu->setSelectorColor({0xe5, 0x1c, 0x23}, 0); @@ -103,6 +103,7 @@ void Title::update() } sprite->animate(); menu->update(); + checkMenu(); } } @@ -139,3 +140,23 @@ section_t Title::run() JA_StopMusic(); } + +// Comprueba el menu +void Title::checkMenu() +{ + const int menu = this->menu->getItemSelected(); + + switch (menu) + { + case 0: + section.name = SECTION_PROG_GAME; + break; + + case 2: + section.name = SECTION_PROG_QUIT; + break; + + default: + break; + } +} \ No newline at end of file diff --git a/source/title.h b/source/title.h index b0f67f3..7af44ca 100644 --- a/source/title.h +++ b/source/title.h @@ -42,6 +42,9 @@ private: // Crea el menu void initMenu(); + // Comprueba el menu + void checkMenu(); + public: // Constructor Title(SDL_Renderer *renderer, Screen *screen, Asset *asset, Input *input);