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:
@@ -38,6 +38,8 @@ Logo::Logo(SDL_Renderer *renderer, Screen *screen, Asset *asset, Input *input, s
|
||||
section->subsection = 0;
|
||||
ticks = 0;
|
||||
ticksSpeed = 15;
|
||||
|
||||
JA_StopMusic();
|
||||
}
|
||||
|
||||
// Destructor
|
||||
@@ -144,8 +146,17 @@ void Logo::run() {
|
||||
JA_StopMusic();
|
||||
|
||||
while (section->name == SECTION_PROG_LOGO) {
|
||||
update();
|
||||
checkEvents();
|
||||
render();
|
||||
iterate();
|
||||
}
|
||||
}
|
||||
|
||||
// Ejecuta un frame
|
||||
void Logo::iterate() {
|
||||
update();
|
||||
render();
|
||||
}
|
||||
|
||||
// Procesa un evento individual
|
||||
void Logo::handleEvent(SDL_Event *event) {
|
||||
// SDL_EVENT_QUIT ya lo maneja Director
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user