migrat a SDL3 Callback API (SDL_AppInit/Iterate/Event/Quit) (milestone 3)

- main.cpp reescrit amb SDL_MAIN_USE_CALLBACKS
- Director convertit a màquina d'estats amb iterate() i handleEvent()
- Seccions (Logo, Intro, Title, Game) amb iterate() i handleEvent()
- Events SDL enrutats via SDL_AppEvent → Director → secció activa
- Eliminat SDL_PollEvent de iterate(), events via handleEvent()
- Transicions entre seccions gestionades per handleSectionTransition()
- Instructions i Game (demo) delegats frame a frame des de Title

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-12 19:32:31 +02:00
parent 18c4d6032d
commit 06d4712493
11 changed files with 306 additions and 132 deletions

View File

@@ -153,6 +153,8 @@ Intro::Intro(SDL_Renderer *renderer, Screen *screen, Asset *asset, Input *input,
for (auto text : texts) {
text->center(GAMECANVAS_CENTER_X);
}
JA_PlayMusic(music, 0);
}
// Destructor
@@ -403,8 +405,17 @@ void Intro::run() {
JA_PlayMusic(music, 0);
while (section->name == SECTION_PROG_INTRO) {
update();
checkEvents();
render();
iterate();
}
}
// Ejecuta un frame
void Intro::iterate() {
update();
render();
}
// Procesa un evento individual
void Intro::handleEvent(SDL_Event *event) {
// SDL_EVENT_QUIT ya lo maneja Director
}