Implementar Modo DEMO (auto-play) con tecla D

CAMBIOS PRINCIPALES:
-  **Modo DEMO toggleable con tecla D** - Auto-play inteligente
-  **Sistema de acciones aleatorias** - Cada 3-8 segundos
-  **Totalmente interactivo** - Usuario puede seguir controlando
-  **Eliminado sistema auto-restart antiguo** - Ya no reinicia al pararse

CARACTERÍSTICAS DEMO MODE:
- **Acciones parametrizables** con pesos de probabilidad:
  * Cambiar gravedad (UP/DOWN/LEFT/RIGHT) - 15%
  * Activar figuras 3D (8 figuras) - 25%
  * Cambiar temas de colores (6 temas) - 20%
  * Cambiar número de pelotas (1-100K) - 15%
  * Impulsos (SPACE) - 10%
  * Toggle profundidad Z - 5%
  * Cambiar escala de figura - 5%
  * Cambiar sprite - 5%

- **Display visual**: "DEMO MODE" centrado en naranja brillante
- **Textos de feedback**: "DEMO MODE ON/OFF" al togglear

CÓDIGO ELIMINADO:
-  `checkAutoRestart()` y `performRandomRestart()` (ya no necesarios)
-  `Ball::isStopped()` y variable `stopped_` (sin uso)
-  Variables `all_balls_stopped_start_time_`, `all_balls_were_stopped_`

CONSTANTES CONFIGURABLES (defines.h):
- `DEMO_ACTION_INTERVAL_MIN/MAX` (3-8s entre acciones)
- `DEMO_WEIGHT_*` (pesos para priorizar acciones)

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

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-10-04 11:28:16 +02:00
parent 2ae515592d
commit 06aabc53c0
6 changed files with 184 additions and 59 deletions

View File

@@ -63,11 +63,6 @@ private:
bool real_fullscreen_enabled_ = false;
ScalingMode current_scaling_mode_ = ScalingMode::INTEGER; // Modo de escalado actual (F5)
// 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;
@@ -100,6 +95,11 @@ private:
float shape_scale_factor_ = 1.0f; // Factor de escala manual (Numpad +/-)
bool depth_zoom_enabled_ = true; // Zoom por profundidad Z activado
// Sistema de Modo DEMO (auto-play)
bool demo_mode_enabled_ = false; // ¿Está activo el modo demo?
float demo_timer_ = 0.0f; // Contador de tiempo para próxima acción
float demo_next_action_time_ = 0.0f; // Tiempo aleatorio hasta próxima acción (segundos)
// Batch rendering
std::vector<SDL_Vertex> batch_vertices_;
std::vector<int> batch_indices_;
@@ -125,8 +125,10 @@ private:
void toggleIntegerScaling();
std::string gravityDirectionToString(GravityDirection direction) const;
void initializeThemes();
void checkAutoRestart();
void performRandomRestart();
// Sistema de Modo DEMO
void updateDemoMode();
void performDemoAction();
// Sistema de transiciones LERP
float lerp(float a, float b, float t) const { return a + (b - a) * t; }