sdl_callbacks
This commit is contained in:
@@ -20,6 +20,7 @@
|
||||
#include "text.hpp" // Para Text
|
||||
#include "texture.hpp" // Para Texture
|
||||
#include "tiled_bg.hpp" // Para TiledBG, TiledBGMode
|
||||
#include "ui/logger.hpp" // Para section
|
||||
#include "utils.hpp" // Para easeOutBounce
|
||||
#include "writer.hpp" // Para Writer
|
||||
|
||||
@@ -39,6 +40,12 @@ Intro::Intro()
|
||||
// Configura el fondo
|
||||
tiled_bg_->setSpeed(TILED_BG_SPEED);
|
||||
tiled_bg_->setColor(bg_color_);
|
||||
|
||||
Logger::section("INTRO");
|
||||
|
||||
// Inicializa el timer de delta time y arranca la música
|
||||
last_time_ = SDL_GetTicks();
|
||||
Audio::get()->playMusic("intro.ogg", 0);
|
||||
}
|
||||
|
||||
// Comprueba los eventos
|
||||
@@ -265,7 +272,20 @@ auto Intro::calculateDeltaTime() -> float {
|
||||
return DELTA_TIME;
|
||||
}
|
||||
|
||||
// Bucle principal
|
||||
// Avanza un frame (llamado desde Director::iterate)
|
||||
void Intro::iterate() {
|
||||
const float DELTA_TIME = calculateDeltaTime();
|
||||
checkInput();
|
||||
update(DELTA_TIME);
|
||||
render();
|
||||
}
|
||||
|
||||
// Procesa un evento (llamado desde Director::handleEvent)
|
||||
void Intro::handleEvent(const SDL_Event& /*event*/) {
|
||||
// Eventos globales ya gestionados por Director::handleEvent
|
||||
}
|
||||
|
||||
// Bucle principal legacy (fallback)
|
||||
void Intro::run() {
|
||||
last_time_ = SDL_GetTicks();
|
||||
Audio::get()->playMusic("intro.ogg", 0);
|
||||
|
||||
Reference in New Issue
Block a user