Implementar sistema de auto-reinicio con temporizador de inactividad

- Añadir getter isStopped() en Ball para detectar pelotas quietas
- Sistema de temporizador de 5 segundos que detecta cuando todas las pelotas están paradas
- Auto-reinicio aleatorio cuando se cumple el tiempo de inactividad:
  * Escenario aleatorio usando test_.size() (1 a 100,000 pelotas)
  * Tema aleatorio usando sizeof(themes_) (5 temas disponibles)
  * Reset inteligente del temporizador si alguna pelota se mueve
- Integración no intrusiva en update() del bucle principal
- Usa infraestructura existente (SDL_GetTicks, initBalls, rand)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-09-27 22:21:30 +02:00
parent 7ac29f899b
commit 79964732ef
3 changed files with 55 additions and 0 deletions

View File

@@ -58,6 +58,11 @@ private:
bool fullscreen_enabled_ = false;
bool real_fullscreen_enabled_ = false;
// Auto-restart system
Uint64 all_balls_stopped_start_time_ = 0; // Momento cuando todas se pararon
bool all_balls_were_stopped_ = false; // Flag de estado anterior
static constexpr Uint64 AUTO_RESTART_DELAY = 5000; // 5 segundos en ms
// Resolución dinámica para modo real fullscreen
int current_screen_width_ = SCREEN_WIDTH;
int current_screen_height_ = SCREEN_HEIGHT;
@@ -96,6 +101,8 @@ private:
void toggleRealFullscreen();
std::string gravityDirectionToString(GravityDirection direction) const;
void initializeThemes();
void checkAutoRestart();
void performRandomRestart();
// Sistema de zoom dinámico
int calculateMaxWindowZoom() const;