forked from jaildesigner-jailgames/jaildoctors_dilemma
style: arreglant capçaleres
This commit is contained in:
@@ -9,10 +9,10 @@
|
||||
#include "core/rendering/surface.hpp" // Para Surface
|
||||
#include "core/rendering/surface_sprite.hpp" // Para SSprite
|
||||
#include "core/resources/resource.hpp" // Para Resource
|
||||
#include "core/system/global_events.hpp" // Para check
|
||||
#include "game/options.hpp" // Para Options, SectionState, options, Section
|
||||
#include "game/scene_manager.hpp" // Para SceneManager
|
||||
#include "utils/delta_timer.hpp" // Para DeltaTimer
|
||||
#include "core/system/global_events.hpp" // Para check
|
||||
#include "utils/utils.hpp" // Para PaletteColor
|
||||
|
||||
// Constructor
|
||||
@@ -21,7 +21,7 @@ Logo::Logo()
|
||||
since_1998_surface_(Resource::get()->getSurface("since_1998.gif")),
|
||||
since_1998_sprite_(std::make_shared<SurfaceSprite>(since_1998_surface_, (256 - since_1998_surface_->getWidth()) / 2, 83 + jailgames_surface_->getHeight() + 5, since_1998_surface_->getWidth(), since_1998_surface_->getHeight())),
|
||||
delta_timer_(std::make_unique<DeltaTimer>()),
|
||||
state_(LogoState::INITIAL),
|
||||
state_(State::INITIAL),
|
||||
state_time_(0.0F) {
|
||||
// Configura variables
|
||||
since_1998_sprite_->setClip(0, 0, since_1998_surface_->getWidth(), since_1998_surface_->getHeight());
|
||||
@@ -54,7 +54,7 @@ void Logo::checkInput() {
|
||||
// Gestiona el logo de JAILGAME (time-based)
|
||||
void Logo::updateJAILGAMES(float delta_time) {
|
||||
// Solo actualizar durante el estado JAILGAMES_SLIDE_IN
|
||||
if (state_ != LogoState::JAILGAMES_SLIDE_IN) {
|
||||
if (state_ != State::JAILGAMES_SLIDE_IN) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -97,21 +97,21 @@ auto Logo::getColorIndex(float progress) const -> int {
|
||||
// Gestiona el color de las texturas
|
||||
void Logo::updateTextureColors() {
|
||||
switch (state_) {
|
||||
case LogoState::SINCE_1998_FADE_IN: {
|
||||
case State::SINCE_1998_FADE_IN: {
|
||||
// Fade-in de "Since 1998" de negro a blanco
|
||||
const float PROGRESS = state_time_ / SINCE_1998_FADE_DURATION;
|
||||
since_1998_color_ = color_[getColorIndex(PROGRESS)];
|
||||
break;
|
||||
}
|
||||
|
||||
case LogoState::DISPLAY: {
|
||||
case State::DISPLAY: {
|
||||
// Asegurar que ambos logos estén en blanco durante el display
|
||||
jailgames_color_ = color_.back(); // BRIGHT_WHITE
|
||||
since_1998_color_ = color_.back(); // BRIGHT_WHITE
|
||||
break;
|
||||
}
|
||||
|
||||
case LogoState::FADE_OUT: {
|
||||
case State::FADE_OUT: {
|
||||
// Fade-out de ambos logos de blanco a negro
|
||||
const float PROGRESS = 1.0F - (state_time_ / FADE_OUT_DURATION);
|
||||
const int COLOR_INDEX = getColorIndex(PROGRESS);
|
||||
@@ -127,7 +127,7 @@ void Logo::updateTextureColors() {
|
||||
}
|
||||
|
||||
// Transiciona a un nuevo estado
|
||||
void Logo::transitionToState(LogoState new_state) {
|
||||
void Logo::transitionToState(State new_state) {
|
||||
state_ = new_state;
|
||||
state_time_ = 0.0F;
|
||||
}
|
||||
@@ -138,38 +138,38 @@ void Logo::updateState(float delta_time) {
|
||||
|
||||
// Gestionar transiciones entre estados basándose en el tiempo
|
||||
switch (state_) {
|
||||
case LogoState::INITIAL:
|
||||
case State::INITIAL:
|
||||
if (state_time_ >= INITIAL_DELAY) {
|
||||
transitionToState(LogoState::JAILGAMES_SLIDE_IN);
|
||||
transitionToState(State::JAILGAMES_SLIDE_IN);
|
||||
}
|
||||
break;
|
||||
|
||||
case LogoState::JAILGAMES_SLIDE_IN:
|
||||
case State::JAILGAMES_SLIDE_IN:
|
||||
if (state_time_ >= JAILGAMES_SLIDE_DURATION) {
|
||||
transitionToState(LogoState::SINCE_1998_FADE_IN);
|
||||
transitionToState(State::SINCE_1998_FADE_IN);
|
||||
}
|
||||
break;
|
||||
|
||||
case LogoState::SINCE_1998_FADE_IN:
|
||||
case State::SINCE_1998_FADE_IN:
|
||||
if (state_time_ >= SINCE_1998_FADE_DURATION) {
|
||||
transitionToState(LogoState::DISPLAY);
|
||||
transitionToState(State::DISPLAY);
|
||||
}
|
||||
break;
|
||||
|
||||
case LogoState::DISPLAY:
|
||||
case State::DISPLAY:
|
||||
if (state_time_ >= DISPLAY_DURATION) {
|
||||
transitionToState(LogoState::FADE_OUT);
|
||||
transitionToState(State::FADE_OUT);
|
||||
}
|
||||
break;
|
||||
|
||||
case LogoState::FADE_OUT:
|
||||
case State::FADE_OUT:
|
||||
if (state_time_ >= FADE_OUT_DURATION) {
|
||||
transitionToState(LogoState::END);
|
||||
transitionToState(State::END);
|
||||
endSection();
|
||||
}
|
||||
break;
|
||||
|
||||
case LogoState::END:
|
||||
case State::END:
|
||||
// Estado final, no hacer nada
|
||||
break;
|
||||
}
|
||||
@@ -180,11 +180,11 @@ void Logo::update() {
|
||||
// Obtener delta time desde el último frame
|
||||
const float DELTA_TIME = delta_timer_->tick();
|
||||
|
||||
checkInput(); // Comprueba las entradas
|
||||
updateState(DELTA_TIME); // Actualiza el estado y gestiona transiciones
|
||||
updateJAILGAMES(DELTA_TIME); // Gestiona el logo de JAILGAME
|
||||
updateTextureColors(); // Gestiona el color de las texturas
|
||||
Screen::get()->update(DELTA_TIME); // Actualiza el objeto Screen
|
||||
checkInput(); // Comprueba las entradas
|
||||
updateState(DELTA_TIME); // Actualiza el estado y gestiona transiciones
|
||||
updateJAILGAMES(DELTA_TIME); // Gestiona el logo de JAILGAME
|
||||
updateTextureColors(); // Gestiona el color de las texturas
|
||||
Screen::get()->update(DELTA_TIME); // Actualiza el objeto Screen
|
||||
}
|
||||
|
||||
// Dibuja en pantalla
|
||||
|
||||
Reference in New Issue
Block a user