sdl_callbacks

This commit is contained in:
2026-04-14 12:21:00 +02:00
parent c0accd25e2
commit f5da35bfb2
20 changed files with 406 additions and 177 deletions

View File

@@ -24,6 +24,7 @@
#include "sprite.hpp" // Para Sprite
#include "text.hpp" // Para Text
#include "tiled_bg.hpp" // Para TiledBG, TiledBGMode
#include "ui/logger.hpp" // Para section
#include "ui/notifier.hpp" // Para Notifier
#include "ui/service_menu.hpp" // Para ServiceMenu
#include "utils.hpp" // Para Zone, BLOCK
@@ -59,6 +60,11 @@ Title::Title()
anchor_.mini_logo = (param.game.height / MINI_LOGO_Y_DIVISOR * MINI_LOGO_Y_FACTOR) + BLOCK;
mini_logo_sprite_->setY(anchor_.mini_logo);
anchor_.copyright_text = anchor_.mini_logo + mini_logo_sprite_->getHeight() + COPYRIGHT_TEXT_SPACING;
Logger::section("TITLE");
// Inicializa el timer de delta time para el primer frame del callback
last_time_ = SDL_GetTicks();
}
// Destructor
@@ -213,7 +219,22 @@ void Title::activatePlayerAndSetState(Player::Id player_id) {
counter_time_ = 0.0F;
}
// Bucle para el titulo del juego
// Avanza un frame (llamado desde Director::iterate)
void Title::iterate() {
const float DELTA_TIME = calculateDeltaTime();
checkInput();
update(DELTA_TIME);
render();
}
// Procesa un evento (llamado desde Director::handleEvent)
void Title::handleEvent(const SDL_Event& event) {
if (event.type == SDL_EVENT_KEY_DOWN) {
handleKeyDownEvent(event);
}
}
// Bucle para el titulo del juego (fallback legacy)
void Title::run() {
last_time_ = SDL_GetTicks();