#pragma once #include // for unique_ptr #include // for vector #include "ball.h" // for Ball class #include "defines.h" // for Color, ColorTheme #include "themes/theme.h" // for Theme interface /** * ThemeManager: Gestiona el sistema de temas visuales (unificado, estáticos y dinámicos) * * PHASE 2 - Sistema Unificado: * - Vector unificado de 10 temas (7 estáticos + 3 dinámicos) * - Índices 0-9 mapeados a ColorTheme enum (SUNSET=0, OCEAN=1, ..., NEON_PULSE=9) * - API simplificada: switchToTheme(0-9) para cualquier tema * - Sin lógica dual (eliminados if(dynamic_theme_active_) scattered) * * Responsabilidades: * - Mantener 10 temas polimórficos (StaticTheme / DynamicTheme) * - Actualizar animación de tema activo si es dinámico * - Proporcionar colores interpolados para renderizado * - Preparar para PHASE 3 (LERP universal entre cualquier par de temas) * * Uso desde Engine: * - initialize() al inicio * - update(delta_time) cada frame * - switchToTheme(0-9) para cambiar tema (Numpad 1-0, Tecla B) * - getInterpolatedColor(index) en render loop */ class ThemeManager { public: // Constructor/Destructor ThemeManager() = default; ~ThemeManager() = default; // Inicialización void initialize(); // Inicializa 10 temas unificados (7 estáticos + 3 dinámicos) // Interfaz unificada (PHASE 2) void switchToTheme(int theme_index); // Cambia a tema 0-9 (instantáneo por ahora, LERP en PHASE 3) void update(float delta_time); // Actualiza tema activo (solo si es dinámico) void cycleTheme(); // Cicla al siguiente tema (0→1→...→9→0) - Tecla B void pauseDynamic(); // Toggle pausa de animación (Shift+D, solo dinámicos) // Queries de colores (usado en rendering) Color getInterpolatedColor(size_t ball_index) const; // Obtiene color interpolado para pelota void getBackgroundColors(float& top_r, float& top_g, float& top_b, float& bottom_r, float& bottom_g, float& bottom_b) const; // Obtiene colores de fondo degradado // Queries de estado (para debug display y lógica) int getCurrentThemeIndex() const { return current_theme_index_; } bool isCurrentThemeDynamic() const; // Obtener información de tema actual para debug display const char* getCurrentThemeNameEN() const; const char* getCurrentThemeNameES() const; void getCurrentThemeTextColor(int& r, int& g, int& b) const; // Obtener color inicial para nuevas pelotas (usado en initBalls) Color getInitialBallColor(int random_index) const; private: // ======================================== // DATOS UNIFICADOS (PHASE 2) // ======================================== // Vector unificado de 10 temas (índices 0-9) // 0-6: Estáticos (SUNSET, OCEAN, NEON, FOREST, RGB, MONOCHROME, LAVENDER) // 7-9: Dinámicos (SUNRISE, OCEAN_WAVES, NEON_PULSE) std::vector> themes_; // Índice de tema activo actual (0-9) int current_theme_index_ = 0; // Por defecto SUNSET // ======================================== // MÉTODOS PRIVADOS // ======================================== // Inicialización void initializeStaticThemes(); // Crea 7 temas estáticos (índices 0-6) void initializeDynamicThemes(); // Crea 3 temas dinámicos (índices 7-9) };