From 7e2691e33e18b725474e0754f38ea5621769da74 Mon Sep 17 00:00:00 2001 From: Sergio Valor Date: Wed, 30 Oct 2024 21:29:23 +0100 Subject: [PATCH] Finalitzat el Attract Mode --- source/director.cpp | 1 + source/logo.cpp | 7 +++++++ source/logo.h | 2 +- source/section.cpp | 1 + source/section.h | 8 ++++++++ source/title.cpp | 3 +++ source/title.h | 10 +++++----- 7 files changed, 26 insertions(+), 6 deletions(-) diff --git a/source/director.cpp b/source/director.cpp index 336b75c..b0a5266 100644 --- a/source/director.cpp +++ b/source/director.cpp @@ -56,6 +56,7 @@ Director::Director(int argc, const char *argv[]) section::name = section::Name::LOGO; #else section::name = section::Name::LOGO; + section::attract_mode = section::AttractMode::TITLE_TO_DEMO; #endif #ifndef VERBOSE diff --git a/source/logo.cpp b/source/logo.cpp index f4c8550..6fbdd51 100644 --- a/source/logo.cpp +++ b/source/logo.cpp @@ -53,6 +53,13 @@ Logo::Logo() color_.push_back(Color(0xFF, 0xFF, 0xFF)); // Bright white } +// Destructor +Logo::~Logo() +{ + jail_texture_->setColor(255, 255, 255); + since_texture_->setColor(255, 255, 255); +} + // Recarga todas las texturas void Logo::reloadTextures() { diff --git a/source/logo.h b/source/logo.h index a3e1d09..7de5a72 100644 --- a/source/logo.h +++ b/source/logo.h @@ -65,7 +65,7 @@ public: Logo(); // Destructor - ~Logo() = default; + ~Logo(); // Bucle principal void run(); diff --git a/source/section.cpp b/source/section.cpp index d719a44..7503f04 100644 --- a/source/section.cpp +++ b/source/section.cpp @@ -4,4 +4,5 @@ namespace section { Name name; Options options; + AttractMode attract_mode; } \ No newline at end of file diff --git a/source/section.h b/source/section.h index 7c2d759..a920eaa 100644 --- a/source/section.h +++ b/source/section.h @@ -29,6 +29,14 @@ namespace section NONE = 7, }; + // Variables para el Attract Mode + enum class AttractMode + { + TITLE_TO_DEMO, + TITLE_TO_LOGO, + }; + extern Name name; extern Options options; + extern AttractMode attract_mode; } \ No newline at end of file diff --git a/source/title.cpp b/source/title.cpp index a4d6836..80bad4c 100644 --- a/source/title.cpp +++ b/source/title.cpp @@ -46,6 +46,9 @@ Title::Title() // 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; } // Destructor diff --git a/source/title.h b/source/title.h index 6122a2f..d8f887d 100644 --- a/source/title.h +++ b/source/title.h @@ -47,11 +47,11 @@ private: std::unique_ptr define_buttons_; // Objeto para definir los botones del joystic // Variable - int counter_ = 0; // Temporizador para la pantalla de titulo - Uint32 ticks_ = 0; // Contador de ticks para ajustar la velocidad del programa - section::Name next_section_ = section::Name::GAME_DEMO; // Indica cual es la siguiente sección a cargar cuando termine el contador del titulo - int post_fade_ = 0; // Opción a realizar cuando termina el fundido - int num_controllers_; // Número de mandos conectados + int counter_ = 0; // Temporizador para la pantalla de titulo + Uint32 ticks_ = 0; // Contador de ticks para ajustar la velocidad del programa + section::Name next_section_; // Indica cual es la siguiente sección a cargar cuando termine el contador del titulo + int post_fade_ = 0; // Opción a realizar cuando termina el fundido + int num_controllers_; // Número de mandos conectados // Actualiza las variables del objeto void update();