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

@@ -20,6 +20,7 @@ void ThemeManager::initialize() {
"Sunset",
"Atardecer",
255, 140, 60, // Color texto: naranja cálido
120, 40, 80, // Color fondo notificación: púrpura oscuro (contrasta con naranja)
180.0f / 255.0f, 140.0f / 255.0f, 100.0f / 255.0f, // Fondo superior: naranja suave
40.0f / 255.0f, 20.0f / 255.0f, 60.0f / 255.0f, // Fondo inferior: púrpura oscuro
std::vector<Color>{
@@ -33,6 +34,7 @@ void ThemeManager::initialize() {
"Ocean",
"Océano",
80, 200, 255, // Color texto: azul océano
20, 50, 90, // Color fondo notificación: azul marino oscuro (contrasta con cian)
100.0f / 255.0f, 150.0f / 255.0f, 200.0f / 255.0f, // Fondo superior: azul cielo
20.0f / 255.0f, 40.0f / 255.0f, 80.0f / 255.0f, // Fondo inferior: azul marino
std::vector<Color>{
@@ -46,6 +48,7 @@ void ThemeManager::initialize() {
"Neon",
"Neón",
255, 60, 255, // Color texto: magenta brillante
60, 0, 80, // Color fondo notificación: púrpura muy oscuro (contrasta con neón)
20.0f / 255.0f, 20.0f / 255.0f, 40.0f / 255.0f, // Fondo superior: negro azulado
0.0f / 255.0f, 0.0f / 255.0f, 0.0f / 255.0f, // Fondo inferior: negro
std::vector<Color>{
@@ -59,6 +62,7 @@ void ThemeManager::initialize() {
"Forest",
"Bosque",
100, 255, 100, // Color texto: verde natural
70, 50, 30, // Color fondo notificación: marrón oscuro tierra (contrasta con verde)
144.0f / 255.0f, 238.0f / 255.0f, 144.0f / 255.0f, // Fondo superior: verde claro
101.0f / 255.0f, 67.0f / 255.0f, 33.0f / 255.0f, // Fondo inferior: marrón tierra
std::vector<Color>{
@@ -72,6 +76,7 @@ void ThemeManager::initialize() {
"RGB",
"RGB",
100, 100, 100, // Color texto: gris oscuro
220, 220, 220, // Color fondo notificación: gris muy claro (contrasta sobre blanco)
1.0f, 1.0f, 1.0f, // Fondo superior: blanco puro
1.0f, 1.0f, 1.0f, // Fondo inferior: blanco puro (sin degradado)
std::vector<Color>{
@@ -107,6 +112,7 @@ void ThemeManager::initialize() {
"Monochrome",
"Monocromo",
200, 200, 200, // Color texto: gris claro
50, 50, 50, // Color fondo notificación: gris medio oscuro (contrasta con texto claro)
20.0f / 255.0f, 20.0f / 255.0f, 20.0f / 255.0f, // Fondo superior: gris muy oscuro
0.0f / 255.0f, 0.0f / 255.0f, 0.0f / 255.0f, // Fondo inferior: negro
std::vector<Color>{
@@ -120,6 +126,7 @@ void ThemeManager::initialize() {
"Lavender",
"Lavanda",
255, 200, 100, // Color texto: amarillo cálido
80, 50, 100, // Color fondo notificación: violeta muy oscuro (contrasta con amarillo)
120.0f / 255.0f, 80.0f / 255.0f, 140.0f / 255.0f, // Fondo superior: violeta oscuro
25.0f / 255.0f, 30.0f / 255.0f, 60.0f / 255.0f, // Fondo inferior: azul medianoche
std::vector<Color>{
@@ -133,6 +140,7 @@ void ThemeManager::initialize() {
"Crimson",
"Carmesí",
255, 100, 100, // Color texto: rojo claro
80, 10, 10, // Color fondo notificación: rojo muy oscuro (contrasta con texto claro)
40.0f / 255.0f, 0.0f / 255.0f, 0.0f / 255.0f, // Fondo superior: rojo muy oscuro
0.0f / 255.0f, 0.0f / 255.0f, 0.0f / 255.0f, // Fondo inferior: negro puro
std::vector<Color>{
@@ -146,6 +154,7 @@ void ThemeManager::initialize() {
"Emerald",
"Esmeralda",
100, 255, 100, // Color texto: verde claro
10, 80, 10, // Color fondo notificación: verde muy oscuro (contrasta con texto claro)
0.0f / 255.0f, 40.0f / 255.0f, 0.0f / 255.0f, // Fondo superior: verde muy oscuro
0.0f / 255.0f, 0.0f / 255.0f, 0.0f / 255.0f, // Fondo inferior: negro puro
std::vector<Color>{
@@ -168,6 +177,7 @@ void ThemeManager::initialize() {
{
20.0f / 255.0f, 25.0f / 255.0f, 60.0f / 255.0f, // Fondo superior: azul medianoche
10.0f / 255.0f, 10.0f / 255.0f, 30.0f / 255.0f, // Fondo inferior: azul muy oscuro
20, 30, 80, // Color fondo notificación: azul oscuro (noche)
std::vector<Color>{
{100, 100, 150}, {120, 120, 170}, {90, 90, 140}, {110, 110, 160},
{95, 95, 145}, {105, 105, 155}, {100, 100, 150}, {115, 115, 165}
@@ -178,6 +188,7 @@ void ThemeManager::initialize() {
{
180.0f / 255.0f, 100.0f / 255.0f, 120.0f / 255.0f, // Fondo superior: naranja-rosa
255.0f / 255.0f, 140.0f / 255.0f, 100.0f / 255.0f, // Fondo inferior: naranja cálido
140, 60, 80, // Color fondo notificación: naranja-rojo oscuro (alba)
std::vector<Color>{
{255, 180, 100}, {255, 160, 80}, {255, 200, 120}, {255, 150, 90},
{255, 190, 110}, {255, 170, 95}, {255, 185, 105}, {255, 165, 88}
@@ -188,6 +199,7 @@ void ThemeManager::initialize() {
{
255.0f / 255.0f, 240.0f / 255.0f, 180.0f / 255.0f, // Fondo superior: amarillo claro
255.0f / 255.0f, 255.0f / 255.0f, 220.0f / 255.0f, // Fondo inferior: amarillo muy claro
200, 180, 140, // Color fondo notificación: amarillo oscuro (día)
std::vector<Color>{
{255, 255, 200}, {255, 255, 180}, {255, 255, 220}, {255, 255, 190},
{255, 255, 210}, {255, 255, 185}, {255, 255, 205}, {255, 255, 195}
@@ -209,6 +221,7 @@ void ThemeManager::initialize() {
{
20.0f / 255.0f, 50.0f / 255.0f, 100.0f / 255.0f, // Fondo superior: azul marino
10.0f / 255.0f, 30.0f / 255.0f, 60.0f / 255.0f, // Fondo inferior: azul muy oscuro
10, 30, 70, // Color fondo notificación: azul muy oscuro (profundidad)
std::vector<Color>{
{60, 100, 180}, {50, 90, 170}, {70, 110, 190}, {55, 95, 175},
{65, 105, 185}, {58, 98, 172}, {62, 102, 182}, {52, 92, 168}
@@ -219,6 +232,7 @@ void ThemeManager::initialize() {
{
100.0f / 255.0f, 200.0f / 255.0f, 230.0f / 255.0f, // Fondo superior: turquesa claro
50.0f / 255.0f, 150.0f / 255.0f, 200.0f / 255.0f, // Fondo inferior: turquesa medio
30, 100, 140, // Color fondo notificación: turquesa oscuro (aguas poco profundas)
std::vector<Color>{
{100, 220, 255}, {90, 210, 245}, {110, 230, 255}, {95, 215, 250},
{105, 225, 255}, {98, 218, 248}, {102, 222, 252}, {92, 212, 242}
@@ -240,6 +254,7 @@ void ThemeManager::initialize() {
{
0.0f / 255.0f, 0.0f / 255.0f, 0.0f / 255.0f, // Fondo superior: negro
0.0f / 255.0f, 0.0f / 255.0f, 0.0f / 255.0f, // Fondo inferior: negro
30, 30, 30, // Color fondo notificación: gris muy oscuro (apagado)
std::vector<Color>{
{40, 40, 40}, {50, 50, 50}, {45, 45, 45}, {48, 48, 48},
{42, 42, 42}, {47, 47, 47}, {44, 44, 44}, {46, 46, 46}
@@ -250,6 +265,7 @@ void ThemeManager::initialize() {
{
20.0f / 255.0f, 20.0f / 255.0f, 40.0f / 255.0f, // Fondo superior: azul oscuro
0.0f / 255.0f, 0.0f / 255.0f, 0.0f / 255.0f, // Fondo inferior: negro
60, 0, 80, // Color fondo notificación: púrpura oscuro (neón encendido)
std::vector<Color>{
{0, 255, 255}, {255, 0, 255}, {0, 255, 200}, {255, 50, 255},
{50, 255, 255}, {255, 0, 200}, {0, 255, 230}, {255, 80, 255}
@@ -271,6 +287,7 @@ void ThemeManager::initialize() {
{
60.0f / 255.0f, 20.0f / 255.0f, 10.0f / 255.0f, // Fondo superior: rojo muy oscuro
20.0f / 255.0f, 10.0f / 255.0f, 0.0f / 255.0f, // Fondo inferior: casi negro
70, 20, 10, // Color fondo notificación: rojo muy oscuro (brasas)
std::vector<Color>{
{120, 40, 20}, {140, 35, 15}, {130, 38, 18}, {125, 42, 22},
{135, 37, 16}, {128, 40, 20}, {132, 39, 19}, {138, 36, 17}
@@ -281,6 +298,7 @@ void ThemeManager::initialize() {
{
180.0f / 255.0f, 80.0f / 255.0f, 20.0f / 255.0f, // Fondo superior: naranja fuerte
100.0f / 255.0f, 30.0f / 255.0f, 10.0f / 255.0f, // Fondo inferior: rojo oscuro
110, 40, 10, // Color fondo notificación: naranja-rojo oscuro (llamas)
std::vector<Color>{
{255, 140, 0}, {255, 120, 10}, {255, 160, 20}, {255, 130, 5},
{255, 150, 15}, {255, 125, 8}, {255, 145, 12}, {255, 135, 18}
@@ -291,6 +309,7 @@ void ThemeManager::initialize() {
{
255.0f / 255.0f, 180.0f / 255.0f, 80.0f / 255.0f, // Fondo superior: amarillo-naranja brillante
220.0f / 255.0f, 100.0f / 255.0f, 30.0f / 255.0f, // Fondo inferior: naranja intenso
160, 80, 30, // Color fondo notificación: naranja oscuro (inferno)
std::vector<Color>{
{255, 220, 100}, {255, 200, 80}, {255, 240, 120}, {255, 210, 90},
{255, 230, 110}, {255, 205, 85}, {255, 225, 105}, {255, 215, 95}
@@ -301,6 +320,7 @@ void ThemeManager::initialize() {
{
180.0f / 255.0f, 80.0f / 255.0f, 20.0f / 255.0f, // Fondo superior: naranja fuerte
100.0f / 255.0f, 30.0f / 255.0f, 10.0f / 255.0f, // Fondo inferior: rojo oscuro
110, 40, 10, // Color fondo notificación: naranja-rojo oscuro (llamas)
std::vector<Color>{
{255, 140, 0}, {255, 120, 10}, {255, 160, 20}, {255, 130, 5},
{255, 150, 15}, {255, 125, 8}, {255, 145, 12}, {255, 135, 18}
@@ -322,6 +342,7 @@ void ThemeManager::initialize() {
{
30.0f / 255.0f, 80.0f / 255.0f, 60.0f / 255.0f, // Fondo superior: verde oscuro
10.0f / 255.0f, 20.0f / 255.0f, 30.0f / 255.0f, // Fondo inferior: azul muy oscuro
15, 50, 40, // Color fondo notificación: verde muy oscuro (aurora verde)
std::vector<Color>{
{100, 255, 180}, {80, 240, 160}, {120, 255, 200}, {90, 245, 170},
{110, 255, 190}, {85, 242, 165}, {105, 252, 185}, {95, 248, 175}
@@ -332,6 +353,7 @@ void ThemeManager::initialize() {
{
120.0f / 255.0f, 60.0f / 255.0f, 180.0f / 255.0f, // Fondo superior: violeta
40.0f / 255.0f, 20.0f / 255.0f, 80.0f / 255.0f, // Fondo inferior: violeta oscuro
70, 30, 100, // Color fondo notificación: violeta oscuro (aurora violeta)
std::vector<Color>{
{200, 100, 255}, {180, 80, 240}, {220, 120, 255}, {190, 90, 245},
{210, 110, 255}, {185, 85, 242}, {205, 105, 252}, {195, 95, 248}
@@ -342,6 +364,7 @@ void ThemeManager::initialize() {
{
60.0f / 255.0f, 180.0f / 255.0f, 220.0f / 255.0f, // Fondo superior: cian brillante
20.0f / 255.0f, 80.0f / 255.0f, 120.0f / 255.0f, // Fondo inferior: azul oscuro
20, 90, 120, // Color fondo notificación: cian oscuro (aurora cian)
std::vector<Color>{
{100, 220, 255}, {80, 200, 240}, {120, 240, 255}, {90, 210, 245},
{110, 230, 255}, {85, 205, 242}, {105, 225, 252}, {95, 215, 248}
@@ -352,6 +375,7 @@ void ThemeManager::initialize() {
{
120.0f / 255.0f, 60.0f / 255.0f, 180.0f / 255.0f, // Fondo superior: violeta
40.0f / 255.0f, 20.0f / 255.0f, 80.0f / 255.0f, // Fondo inferior: violeta oscuro
70, 30, 100, // Color fondo notificación: violeta oscuro (aurora violeta)
std::vector<Color>{
{200, 100, 255}, {180, 80, 240}, {220, 120, 255}, {190, 90, 245},
{210, 110, 255}, {185, 85, 242}, {205, 105, 252}, {195, 95, 248}
@@ -373,6 +397,7 @@ void ThemeManager::initialize() {
{
40.0f / 255.0f, 40.0f / 255.0f, 45.0f / 255.0f, // Fondo superior: gris oscuro
20.0f / 255.0f, 15.0f / 255.0f, 15.0f / 255.0f, // Fondo inferior: casi negro
50, 50, 55, // Color fondo notificación: gris oscuro (ceniza)
std::vector<Color>{
{80, 80, 90}, {75, 75, 85}, {85, 85, 95}, {78, 78, 88},
{82, 82, 92}, {76, 76, 86}, {84, 84, 94}, {79, 79, 89}
@@ -383,6 +408,7 @@ void ThemeManager::initialize() {
{
180.0f / 255.0f, 60.0f / 255.0f, 30.0f / 255.0f, // Fondo superior: naranja-rojo
80.0f / 255.0f, 20.0f / 255.0f, 10.0f / 255.0f, // Fondo inferior: rojo oscuro
120, 30, 15, // Color fondo notificación: naranja-rojo oscuro (erupción)
std::vector<Color>{
{255, 80, 40}, {255, 100, 50}, {255, 70, 35}, {255, 90, 45},
{255, 75, 38}, {255, 95, 48}, {255, 85, 42}, {255, 78, 40}
@@ -393,6 +419,7 @@ void ThemeManager::initialize() {
{
220.0f / 255.0f, 120.0f / 255.0f, 40.0f / 255.0f, // Fondo superior: naranja brillante
180.0f / 255.0f, 60.0f / 255.0f, 20.0f / 255.0f, // Fondo inferior: naranja-rojo
150, 70, 25, // Color fondo notificación: naranja oscuro (lava)
std::vector<Color>{
{255, 180, 80}, {255, 200, 100}, {255, 170, 70}, {255, 190, 90},
{255, 175, 75}, {255, 195, 95}, {255, 185, 85}, {255, 178, 78}
@@ -403,6 +430,7 @@ void ThemeManager::initialize() {
{
100.0f / 255.0f, 80.0f / 255.0f, 70.0f / 255.0f, // Fondo superior: gris-naranja
50.0f / 255.0f, 40.0f / 255.0f, 35.0f / 255.0f, // Fondo inferior: gris oscuro
80, 60, 50, // Color fondo notificación: gris-naranja oscuro (enfriamiento)
std::vector<Color>{
{150, 120, 100}, {140, 110, 90}, {160, 130, 110}, {145, 115, 95},
{155, 125, 105}, {142, 112, 92}, {158, 128, 108}, {148, 118, 98}
@@ -567,6 +595,22 @@ void ThemeManager::getCurrentThemeTextColor(int& r, int& g, int& b) const {
b = static_cast<int>(lerp(static_cast<float>(source_snapshot_->text_color_b), static_cast<float>(target_b), transition_progress_));
}
void ThemeManager::getCurrentNotificationBackgroundColor(int& r, int& g, int& b) const {
if (!transitioning_ || !source_snapshot_) {
// Sin transición: color directo del tema activo
themes_[current_theme_index_]->getNotificationBackgroundColor(r, g, b);
return;
}
// PHASE 3: Con transición: LERP entre snapshot origen y tema destino
int target_r, target_g, target_b;
themes_[current_theme_index_]->getNotificationBackgroundColor(target_r, target_g, target_b);
r = static_cast<int>(lerp(static_cast<float>(source_snapshot_->notif_bg_r), static_cast<float>(target_r), transition_progress_));
g = static_cast<int>(lerp(static_cast<float>(source_snapshot_->notif_bg_g), static_cast<float>(target_g), transition_progress_));
b = static_cast<int>(lerp(static_cast<float>(source_snapshot_->notif_bg_b), static_cast<float>(target_b), transition_progress_));
}
Color ThemeManager::getInitialBallColor(int random_index) const {
// Obtener color inicial del tema activo (progress = 0.0f)
return themes_[current_theme_index_]->getBallColor(random_index, 0.0f);
@@ -588,6 +632,10 @@ std::unique_ptr<ThemeSnapshot> ThemeManager::captureCurrentSnapshot() const {
themes_[current_theme_index_]->getTextColor(
snapshot->text_color_r, snapshot->text_color_g, snapshot->text_color_b);
// Capturar color de fondo de notificaciones
themes_[current_theme_index_]->getNotificationBackgroundColor(
snapshot->notif_bg_r, snapshot->notif_bg_g, snapshot->notif_bg_b);
// Capturar nombres
snapshot->name_en = themes_[current_theme_index_]->getNameEN();
snapshot->name_es = themes_[current_theme_index_]->getNameES();