Title: optimitzat render()
This commit is contained in:
@@ -50,6 +50,11 @@ Title::Title()
|
||||
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;
|
||||
|
||||
// Define los anclajes de los elementos
|
||||
anchor_.mini_logo = (param.game.height / 5 * 4) + BLOCK;
|
||||
mini_logo_sprite_->setY(anchor_.mini_logo);
|
||||
anchor_.copyright_text = anchor_.mini_logo + mini_logo_sprite_->getHeight() + 3;
|
||||
}
|
||||
|
||||
// Destructor
|
||||
@@ -80,20 +85,9 @@ void Title::render()
|
||||
|
||||
tiled_bg_->render();
|
||||
game_logo_->render();
|
||||
|
||||
if (state_ != TitleState::LOGO_ANIMATING)
|
||||
{
|
||||
// Mini logo
|
||||
const int pos1 = (param.game.height / 5 * 4) + BLOCK;
|
||||
const int pos2 = pos1 + mini_logo_sprite_->getHeight() + 3;
|
||||
mini_logo_sprite_->setY(pos1);
|
||||
mini_logo_sprite_->render();
|
||||
|
||||
// Texto con el copyright
|
||||
text_->writeDX(TEXT_CENTER | TEXT_SHADOW, param.game.game_area.center_x, pos2, TEXT_COPYRIGHT, 1, NO_TEXT_COLOR, 1, TITLE_SHADOW_TEXT_COLOR);
|
||||
}
|
||||
|
||||
renderStartPrompt();
|
||||
renderCopyright();
|
||||
|
||||
define_buttons_->render();
|
||||
fade_->render();
|
||||
|
||||
@@ -377,4 +371,23 @@ void Title::renderStartPrompt()
|
||||
1,
|
||||
TITLE_SHADOW_TEXT_COLOR);
|
||||
}
|
||||
}
|
||||
|
||||
void Title::renderCopyright()
|
||||
{
|
||||
if (state_ != TitleState::LOGO_ANIMATING)
|
||||
{
|
||||
// Mini logo
|
||||
mini_logo_sprite_->render();
|
||||
|
||||
// Texto con el copyright
|
||||
text_->writeDX(TEXT_CENTER | TEXT_SHADOW,
|
||||
param.game.game_area.center_x,
|
||||
anchor_.copyright_text,
|
||||
TEXT_COPYRIGHT,
|
||||
1,
|
||||
NO_TEXT_COLOR,
|
||||
1,
|
||||
TITLE_SHADOW_TEXT_COLOR);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user