canvi de pc (toquejant Options)

This commit is contained in:
2025-06-14 16:28:36 +02:00
parent 4b8cc67b5c
commit 23e8f90274
27 changed files with 505 additions and 454 deletions

View File

@@ -46,10 +46,10 @@ Title::Title()
Resource::get()->getTexture("smb2.gif")->setPalette(1);
// Asigna valores a otras variables
section::options = section::Options::TITLE_1;
const bool IS_TITLE_TO_DEMO = (section::attract_mode == section::AttractMode::TITLE_TO_DEMO);
next_section_ = IS_TITLE_TO_DEMO ? section::Name::GAME_DEMO : section::Name::LOGO;
section::attract_mode = IS_TITLE_TO_DEMO ? section::AttractMode::TITLE_TO_LOGO : section::AttractMode::TITLE_TO_DEMO;
Section::options = Section::Options::TITLE_1;
const bool IS_TITLE_TO_DEMO = (Section::attract_mode == Section::AttractMode::TITLE_TO_DEMO);
next_section_ = IS_TITLE_TO_DEMO ? Section::Name::GAME_DEMO : Section::Name::LOGO;
Section::attract_mode = IS_TITLE_TO_DEMO ? Section::AttractMode::TITLE_TO_LOGO : Section::AttractMode::TITLE_TO_DEMO;
}
// Destructor
@@ -112,7 +112,7 @@ void Title::render()
// 'PRESS TO PLAY'
if (counter_ % 50 > 14 && !define_buttons_->isEnabled())
{
text_->writeDX(TEXT_CENTER | TEXT_SHADOW, param.game.game_area.center_x, param.title.press_start_position, lang::getText("[TITLE] PRESS_BUTTON_TO_PLAY"), 1, NO_COLOR, 1, shadow);
text_->writeDX(TEXT_CENTER | TEXT_SHADOW, param.game.game_area.center_x, param.title.press_start_position, Lang::getText("[TITLE] PRESS_BUTTON_TO_PLAY"), 1, NO_COLOR, 1, shadow);
}
}
@@ -121,7 +121,7 @@ void Title::render()
// 'PRESS TO PLAY'
if (counter_ % 10 > 4 && !define_buttons_->isEnabled())
{
text_->writeDX(TEXT_CENTER | TEXT_SHADOW, param.game.game_area.center_x, param.title.press_start_position, lang::getText("[TITLE] PRESS_BUTTON_TO_PLAY"), 1, NO_COLOR, 1, shadow);
text_->writeDX(TEXT_CENTER | TEXT_SHADOW, param.game.game_area.center_x, param.title.press_start_position, Lang::getText("[TITLE] PRESS_BUTTON_TO_PLAY"), 1, NO_COLOR, 1, shadow);
}
}
@@ -181,7 +181,7 @@ void Title::checkEvents()
}
}
globalEvents::check(event);
GlobalEvents::check(event);
define_buttons_->checkEvents(event);
}
}
@@ -208,13 +208,13 @@ void Title::checkInput()
switch (CONTROLLER.player_id)
{
case 1:
selection_ = section::Options::GAME_PLAY_1P;
selection_ = Section::Options::GAME_PLAY_1P;
break;
case 2:
selection_ = section::Options::GAME_PLAY_2P;
selection_ = Section::Options::GAME_PLAY_2P;
break;
default:
selection_ = section::Options::TITLE_TIME_OUT;
selection_ = Section::Options::TITLE_TIME_OUT;
break;
}
state_ = TitleState::START_HAS_BEEN_PRESSED;
@@ -243,13 +243,13 @@ void Title::checkInput()
}
// Comprueba los inputs que se pueden introducir en cualquier sección del juego
globalInputs::check();
GlobalInputs::check();
}
// Bucle para el titulo del juego
void Title::run()
{
while (section::name == section::Name::TITLE)
while (Section::name == Section::Name::TITLE)
{
checkInput();
update();
@@ -277,7 +277,7 @@ void Title::swapControllers()
void Title::swapKeyboard()
{
swapOptionsKeyboard();
std::string text = lang::getText("[DEFINE_BUTTONS] PLAYER") + std::to_string(getPlayerWhoUsesKeyboard()) + ": " + lang::getText("[DEFINE_BUTTONS] KEYBOARD");
std::string text = Lang::getText("[DEFINE_BUTTONS] PLAYER") + std::to_string(getPlayerWhoUsesKeyboard()) + ": " + Lang::getText("[DEFINE_BUTTONS] KEYBOARD");
Notifier::get()->show({text});
}
@@ -302,7 +302,7 @@ void Title::showControllers()
const size_t index = player_controller_index.at(i);
if (options.controllers.at(index).plugged)
{
text.at(i) = lang::getText("[DEFINE_BUTTONS] PLAYER") + std::to_string(i + 1) + ": " + options.controllers.at(index).name;
text.at(i) = Lang::getText("[DEFINE_BUTTONS] PLAYER") + std::to_string(i + 1) + ": " + options.controllers.at(index).name;
}
}
@@ -316,16 +316,16 @@ void Title::updateFade()
fade_->update();
if (fade_->hasEnded())
{
if (selection_ == section::Options::TITLE_TIME_OUT)
if (selection_ == Section::Options::TITLE_TIME_OUT)
{
// El menu ha hecho time out
section::name = next_section_;
Section::name = next_section_;
}
else
{
// Se ha pulsado para jugar
section::name = section::Name::GAME;
section::options = selection_;
Section::name = Section::Name::GAME;
Section::options = selection_;
Audio::get()->stopMusic();
}
}
@@ -363,7 +363,7 @@ void Title::updateState()
// El menu ha hecho time out
fade_->setPostDuration(0);
fade_->activate();
selection_ = section::Options::TITLE_TIME_OUT;
selection_ = Section::Options::TITLE_TIME_OUT;
}
break;