forked from jaildesigner-jailgames/jaildoctors_dilemma
style: arreglant capçaleres
This commit is contained in:
@@ -11,11 +11,11 @@
|
||||
#include "core/rendering/surface_sprite.hpp" // Para SSprite
|
||||
#include "core/rendering/text.hpp" // Para Text, TEXT_CENTER, TEXT_COLOR
|
||||
#include "core/resources/resource.hpp" // Para Resource
|
||||
#include "core/system/global_events.hpp" // Para check
|
||||
#include "game/gameplay/cheevos.hpp" // Para Cheevos, Achievement
|
||||
#include "game/options.hpp" // Para Options, options, SectionState, Section
|
||||
#include "game/scene_manager.hpp" // Para SceneManager
|
||||
#include "utils/defines.hpp" // Para PLAY_AREA_CENTER_X, GAMECANVAS_WIDTH
|
||||
#include "core/system/global_events.hpp" // Para check
|
||||
#include "utils/utils.hpp" // Para stringToColor, PaletteColor, playMusic
|
||||
|
||||
// Constructor
|
||||
@@ -33,7 +33,7 @@ Title::Title()
|
||||
fade_accumulator_(0.0F),
|
||||
current_delta_(0.0F) {
|
||||
// Inicializa variables
|
||||
state_ = SceneManager::options == SceneManager::Options::TITLE_WITH_LOADING_SCREEN ? TitleState::SHOW_LOADING_SCREEN : TitleState::SHOW_MENU;
|
||||
state_ = SceneManager::options == SceneManager::Options::TITLE_WITH_LOADING_SCREEN ? State::SHOW_LOADING_SCREEN : State::SHOW_MENU;
|
||||
SceneManager::current = SceneManager::Scene::TITLE;
|
||||
SceneManager::options = SceneManager::Options::NONE;
|
||||
initMarquee();
|
||||
@@ -58,10 +58,10 @@ void Title::initMarquee() {
|
||||
|
||||
// Pre-calcular anchos de caracteres para eficiencia
|
||||
for (size_t i = 0; i < long_text_.length(); ++i) {
|
||||
TitleLetter l;
|
||||
l.letter = long_text_[i]; // char directo, no substring
|
||||
l.x = MARQUEE_START_X; // Usar constante
|
||||
l.width = marquee_text_->lenght(std::string(1, long_text_[i])); // Pre-calcular ancho
|
||||
Glyph l;
|
||||
l.letter = long_text_[i]; // char directo, no substring
|
||||
l.x = MARQUEE_START_X; // Usar constante
|
||||
l.width = marquee_text_->lenght(std::string(1, long_text_[i])); // Pre-calcular ancho
|
||||
l.enabled = false;
|
||||
letters_.push_back(l);
|
||||
}
|
||||
@@ -111,8 +111,8 @@ void Title::checkInput() {
|
||||
}
|
||||
|
||||
if (Input::get()->checkInput(InputAction::ACCEPT, INPUT_DO_NOT_ALLOW_REPEAT)) {
|
||||
if (state_ == TitleState::SHOW_LOADING_SCREEN) {
|
||||
transitionToState(TitleState::FADE_LOADING_SCREEN);
|
||||
if (state_ == State::SHOW_LOADING_SCREEN) {
|
||||
transitionToState(State::FADE_LOADING_SCREEN);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -158,11 +158,10 @@ void Title::renderMarquee() {
|
||||
const auto& letter = letters_[i];
|
||||
if (letter.enabled) {
|
||||
marquee_text_->writeColored(
|
||||
static_cast<int>(letter.x), // Conversión explícita float→int
|
||||
static_cast<int>(MARQUEE_Y), // Usar constante
|
||||
std::string(1, letter.letter), // Convertir char a string
|
||||
static_cast<Uint8>(PaletteColor::BRIGHT_RED)
|
||||
);
|
||||
static_cast<int>(letter.x), // Conversión explícita float→int
|
||||
static_cast<int>(MARQUEE_Y), // Usar constante
|
||||
std::string(1, letter.letter), // Convertir char a string
|
||||
static_cast<Uint8>(PaletteColor::BRIGHT_RED));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -187,23 +186,23 @@ void Title::updateState(float delta_time) {
|
||||
state_time_ += delta_time;
|
||||
|
||||
switch (state_) {
|
||||
case TitleState::SHOW_LOADING_SCREEN:
|
||||
case State::SHOW_LOADING_SCREEN:
|
||||
if (state_time_ >= SHOW_LOADING_DURATION) {
|
||||
transitionToState(TitleState::FADE_LOADING_SCREEN);
|
||||
transitionToState(State::FADE_LOADING_SCREEN);
|
||||
}
|
||||
break;
|
||||
|
||||
case TitleState::FADE_LOADING_SCREEN:
|
||||
case State::FADE_LOADING_SCREEN:
|
||||
fade_accumulator_ += delta_time;
|
||||
if (fade_accumulator_ >= FADE_STEP_INTERVAL) {
|
||||
fade_accumulator_ = 0.0F;
|
||||
if (loading_screen_surface_->fadeSubPalette()) {
|
||||
transitionToState(TitleState::SHOW_MENU);
|
||||
transitionToState(State::SHOW_MENU);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case TitleState::SHOW_MENU:
|
||||
case State::SHOW_MENU:
|
||||
// Actualiza la marquesina
|
||||
updateMarquee(delta_time);
|
||||
|
||||
@@ -220,7 +219,7 @@ void Title::updateState(float delta_time) {
|
||||
}
|
||||
|
||||
// Transiciona a un nuevo estado
|
||||
void Title::transitionToState(TitleState new_state) {
|
||||
void Title::transitionToState(State new_state) {
|
||||
state_ = new_state;
|
||||
state_time_ = 0.0F;
|
||||
fade_accumulator_ = 0.0F;
|
||||
@@ -233,7 +232,7 @@ void Title::render() {
|
||||
Screen::get()->clearSurface(static_cast<Uint8>(PaletteColor::BLACK));
|
||||
|
||||
switch (state_) {
|
||||
case TitleState::SHOW_MENU:
|
||||
case State::SHOW_MENU:
|
||||
// Dibuja la textura de fondo
|
||||
bg_surface_->render(0, 0);
|
||||
|
||||
@@ -246,8 +245,8 @@ void Title::render() {
|
||||
}
|
||||
break;
|
||||
|
||||
case TitleState::SHOW_LOADING_SCREEN:
|
||||
case TitleState::FADE_LOADING_SCREEN:
|
||||
case State::SHOW_LOADING_SCREEN:
|
||||
case State::FADE_LOADING_SCREEN:
|
||||
loading_screen_sprite_->render();
|
||||
title_logo_sprite_->render();
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user