Add: Sistema de notificaciones con colores de fondo temáticos

CARACTERÍSTICAS:
- Notificaciones con fondo personalizado por tema (15 temas)
- Soporte completo para temas estáticos y dinámicos
- Interpolación LERP de colores durante transiciones
- Actualización por frame durante animaciones de temas

IMPLEMENTACIÓN:

Theme System:
- Añadido getNotificationBackgroundColor() a interfaz Theme
- StaticTheme: Color fijo por tema
- DynamicTheme: Interpolación entre keyframes
- ThemeManager: LERP durante transiciones (PHASE 3)
- ThemeSnapshot: Captura color para transiciones suaves

Colores por Tema:
Estáticos (9):
  - SUNSET: Púrpura oscuro (120, 40, 80)
  - OCEAN: Azul marino (20, 50, 90)
  - NEON: Púrpura oscuro (60, 0, 80)
  - FOREST: Marrón tierra (70, 50, 30)
  - RGB: Gris claro (220, 220, 220)
  - MONOCHROME: Gris oscuro (50, 50, 50)
  - LAVENDER: Violeta oscuro (80, 50, 100)
  - CRIMSON: Rojo oscuro (80, 10, 10)
  - EMERALD: Verde oscuro (10, 80, 10)

Dinámicos (6, 20 keyframes totales):
  - SUNRISE: 3 keyframes (noche→alba→día)
  - OCEAN_WAVES: 2 keyframes (profundo→claro)
  - NEON_PULSE: 2 keyframes (apagado→encendido)
  - FIRE: 4 keyframes (brasas→llamas→inferno→llamas)
  - AURORA: 4 keyframes (verde→violeta→cian→violeta)
  - VOLCANIC: 4 keyframes (ceniza→erupción→lava→enfriamiento)

Notifier:
- Añadido SDL_Color bg_color a estructura Notification
- Método show() acepta parámetro bg_color
- renderBackground() usa color dinámico (no negro fijo)
- Soporte para cambios de color cada frame

Engine:
- Obtiene color de fondo desde ThemeManager
- Pasa bg_color al notifier en cada notificación
- Sincronizado con tema activo y transiciones

FIXES:
- TEXT_ABSOLUTE_SIZE cambiado de 16px a 12px (múltiplo nativo)
- Centrado de notificaciones corregido en F3 fullscreen
- updatePhysicalWindowSize() usa SDL_GetCurrentDisplayMode en F3
- Notificaciones centradas correctamente en ventana/F3/F4

🎨 Generated with Claude Code
This commit is contained in:
2025-10-10 07:17:06 +02:00
parent 68381dc92d
commit 0d1608712b
17 changed files with 818 additions and 12 deletions

View File

@@ -120,3 +120,16 @@ void DynamicTheme::getBackgroundColors(float progress,
bg = lerp(current_kf.bg_bottom_g, target_kf.bg_bottom_g, t);
bb = lerp(current_kf.bg_bottom_b, target_kf.bg_bottom_b, t);
}
void DynamicTheme::getNotificationBackgroundColor(int& r, int& g, int& b) const {
// Obtener keyframes actual y objetivo
const auto& current_kf = keyframes_[current_keyframe_index_];
const auto& target_kf = keyframes_[target_keyframe_index_];
// Interpolar color de fondo de notificación usando progreso interno
float t = transition_progress_;
r = static_cast<int>(lerp(static_cast<float>(current_kf.notif_bg_r), static_cast<float>(target_kf.notif_bg_r), t));
g = static_cast<int>(lerp(static_cast<float>(current_kf.notif_bg_g), static_cast<float>(target_kf.notif_bg_g), t));
b = static_cast<int>(lerp(static_cast<float>(current_kf.notif_bg_b), static_cast<float>(target_kf.notif_bg_b), t));
}

View File

@@ -48,6 +48,7 @@ class DynamicTheme : public Theme {
g = text_g_;
b = text_b_;
}
void getNotificationBackgroundColor(int& r, int& g, int& b) const override;
// ========================================
// CORE: OBTENER COLORES (interpolados)

View File

@@ -2,12 +2,14 @@
StaticTheme::StaticTheme(const char* name_en, const char* name_es,
int text_r, int text_g, int text_b,
int notif_bg_r, int notif_bg_g, int notif_bg_b,
float bg_top_r, float bg_top_g, float bg_top_b,
float bg_bottom_r, float bg_bottom_g, float bg_bottom_b,
std::vector<Color> ball_colors)
: name_en_(name_en),
name_es_(name_es),
text_r_(text_r), text_g_(text_g), text_b_(text_b),
notif_bg_r_(notif_bg_r), notif_bg_g_(notif_bg_g), notif_bg_b_(notif_bg_b),
bg_top_r_(bg_top_r), bg_top_g_(bg_top_g), bg_top_b_(bg_top_b),
bg_bottom_r_(bg_bottom_r), bg_bottom_g_(bg_bottom_g), bg_bottom_b_(bg_bottom_b),
ball_colors_(std::move(ball_colors)) {

View File

@@ -23,12 +23,14 @@ class StaticTheme : public Theme {
* @param name_en: Nombre en inglés
* @param name_es: Nombre en español
* @param text_r, text_g, text_b: Color de texto UI
* @param notif_bg_r, notif_bg_g, notif_bg_b: Color de fondo de notificaciones
* @param bg_top_r, bg_top_g, bg_top_b: Color superior de fondo
* @param bg_bottom_r, bg_bottom_g, bg_bottom_b: Color inferior de fondo
* @param ball_colors: Paleta de colores para pelotas
*/
StaticTheme(const char* name_en, const char* name_es,
int text_r, int text_g, int text_b,
int notif_bg_r, int notif_bg_g, int notif_bg_b,
float bg_top_r, float bg_top_g, float bg_top_b,
float bg_bottom_r, float bg_bottom_g, float bg_bottom_b,
std::vector<Color> ball_colors);
@@ -46,6 +48,11 @@ class StaticTheme : public Theme {
g = text_g_;
b = text_b_;
}
void getNotificationBackgroundColor(int& r, int& g, int& b) const override {
r = notif_bg_r_;
g = notif_bg_g_;
b = notif_bg_b_;
}
// ========================================
// CORE: OBTENER COLORES
@@ -66,6 +73,7 @@ class StaticTheme : public Theme {
std::string name_en_;
std::string name_es_;
int text_r_, text_g_, text_b_;
int notif_bg_r_, notif_bg_g_, notif_bg_b_;
float bg_top_r_, bg_top_g_, bg_top_b_;
float bg_bottom_r_, bg_bottom_g_, bg_bottom_b_;
std::vector<Color> ball_colors_;

View File

@@ -26,6 +26,7 @@ class Theme {
virtual const char* getNameEN() const = 0;
virtual const char* getNameES() const = 0;
virtual void getTextColor(int& r, int& g, int& b) const = 0;
virtual void getNotificationBackgroundColor(int& r, int& g, int& b) const = 0;
// ========================================
// CORE: OBTENER COLORES (polimórfico)

View File

@@ -31,6 +31,9 @@ struct ThemeSnapshot {
// Color de texto UI
int text_color_r, text_color_g, text_color_b;
// Color de fondo de notificaciones
int notif_bg_r, notif_bg_g, notif_bg_b;
// Nombres del tema (para mostrar "SOURCE → TARGET" durante transición)
std::string name_en;
std::string name_es;