Retocado el menu del titulo

This commit is contained in:
2022-08-28 07:50:08 +02:00
parent b6cbc65a2a
commit d937e5578f
4 changed files with 29 additions and 5 deletions

View File

@@ -27,7 +27,7 @@ Game::Game(SDL_Renderer *renderer, Screen *screen, Asset *asset, Input *input)
section.subsection = SUBSECTION_GAME_PLAY; section.subsection = SUBSECTION_GAME_PLAY;
musicEnabled = true; musicEnabled = true;
debug = true; debug = false;
musicEnabled = !debug; musicEnabled = !debug;
} }

View File

@@ -26,7 +26,7 @@ Prog::Prog(std::string executablePath)
} }
else else
{ {
section.name = SECTION_PROG_GAME; section.name = SECTION_PROG_LOGO;
} }
input = new Input(asset->get("gamecontrollerdb.txt")); input = new Input(asset->get("gamecontrollerdb.txt"));
screen = new Screen(window, renderer, options); screen = new Screen(window, renderer, options);

View File

@@ -64,7 +64,7 @@ void Title::initMenu()
menu->loadAudioFile(asset->get("sound_menu_move.wav"), SOUND_MOVE); menu->loadAudioFile(asset->get("sound_menu_move.wav"), SOUND_MOVE);
menu->init("TITLE", 0, 150, MENU_BACKGROUND_TRANSPARENT); menu->init("TITLE", 0, 150, MENU_BACKGROUND_TRANSPARENT);
menu->addItem("START",2); menu->addItem("START", 2);
menu->addItem("OPTIONS", 5); menu->addItem("OPTIONS", 5);
menu->addItem("EXIT"); menu->addItem("EXIT");
menu->setDefaultActionWhenCancel(2); menu->setDefaultActionWhenCancel(2);
@@ -103,6 +103,7 @@ void Title::update()
} }
sprite->animate(); sprite->animate();
menu->update(); menu->update();
checkMenu();
} }
} }
@@ -139,3 +140,23 @@ section_t Title::run()
JA_StopMusic(); 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;
}
}

View File

@@ -42,6 +42,9 @@ private:
// Crea el menu // Crea el menu
void initMenu(); void initMenu();
// Comprueba el menu
void checkMenu();
public: public:
// Constructor // Constructor
Title(SDL_Renderer *renderer, Screen *screen, Asset *asset, Input *input); Title(SDL_Renderer *renderer, Screen *screen, Asset *asset, Input *input);