ServiceMenu: arreglos de colorets

This commit is contained in:
2025-06-21 20:51:10 +02:00
parent b6698043fd
commit 4f81712e3c
6 changed files with 370 additions and 137 deletions

View File

@@ -7,10 +7,12 @@
#include <algorithm> // Para max, min
#include <string> // Para string
#include <vector> // Para vector
#include <array> // Para array
// --- Constantes ---
constexpr int BLOCK = 8;
constexpr int TOTAL_DEMO_DATA = 2000;
constexpr size_t COLOR_CYCLE_SIZE = 6; // Mitad del ciclo espejado
// --- Estructuras y tipos ---
struct Overrides
@@ -33,7 +35,7 @@ struct Circle
: x(xCoord), y(yCoord), r(radius) {}
};
// Estructura para definir un color
// Estructura para definir un color RGB
struct Color
{
Uint8 r, g, b;
@@ -41,14 +43,14 @@ struct Color
explicit constexpr Color(Uint8 red, Uint8 green, Uint8 blue) : r(red), g(green), b(blue) {}
constexpr Color getInverse() const { return Color(255 - r, 255 - g, 255 - b); }
Color lighten(int amount = 50) const
constexpr Color lighten(int amount = 50) const
{
return Color(
std::min(255, r + amount),
std::min(255, g + amount),
std::min(255, b + amount));
}
Color darken(int amount = 50) const
constexpr Color darken(int amount = 50) const
{
return Color(
std::max(0, r - amount),
@@ -57,6 +59,23 @@ struct Color
}
};
// Estructura para definir un color HSV
struct HSV
{
float h, s, v;
};
// Estructura para definir el ciclo de color
enum class ColorCycleStyle
{
SubtlePulse, // Variación leve en brillo (por defecto)
HueWave, // Variación suave en tono (sin verde)
Vibrant, // Cambios agresivos en tono y brillo
DarkenGlow, // Oscurece hacia el centro y regresa
LightFlash // Ilumina hacia el centro y regresa
};
// Posiciones de las notificaciones
enum class NotifyPosition
{
@@ -108,33 +127,41 @@ struct Zone
float third_quarter_y; // Anclaje al 75% del eje Y
};
// --- Alias ---
using ColorCycle = std::array<Color, 2 * COLOR_CYCLE_SIZE>;
// --- Funciones utilitarias ---
// Colores
extern const Color BG_COLOR;
extern const Color NO_COLOR;
extern const Color SHADOW_TEXT_COLOR;
extern const Color SEPARATOR_COLOR;
extern const Color SCOREBOARD_EASY_COLOR;
extern const Color SCOREBOARD_NORMAL_COLOR;
extern const Color SCOREBOARD_HARD_COLOR;
extern const Color FLASH_COLOR;
extern const Color FADE_COLOR;
extern const Color ORANGE_COLOR;
extern const Color ORANGE_SOFT_COLOR;
extern const Color ORANGE_SHADOW_COLOR;
extern const Color GREEN_COLOR;
extern const Color BLUE_SKY_COLOR;
extern const Color PINK_SKY_COLOR;
extern const Color GREEN_SKY_COLOR;
extern const Color SERV_MENU_TITLE_COLOR;
extern const Color SERV_MENU_TEXT_COLOR;
extern const Color SERV_MENU_SELECTED_COLOR;
extern const Color SERV_MENU_BG_COLOR;
extern const Color DEBUG_COLOR;
constexpr Color BG_COLOR = Color(0X27, 0X27, 0X36);
constexpr Color NO_COLOR = Color(0XFF, 0XFF, 0XFF);
constexpr Color SHADOW_TEXT_COLOR = Color(0X43, 0X43, 0X4F);
constexpr Color SEPARATOR_COLOR = Color(0X0D, 0X1A, 0X2B);
constexpr Color SCOREBOARD_EASY_COLOR = Color(0X4B, 0X69, 0X2F);
constexpr Color SCOREBOARD_NORMAL_COLOR = Color(0X2E, 0X3F, 0X47);
constexpr Color SCOREBOARD_HARD_COLOR = Color(0X76, 0X42, 0X8A);
constexpr Color FLASH_COLOR = Color(0XFF, 0XFF, 0XFF);
constexpr Color FADE_COLOR = Color(0X27, 0X27, 0X36);
constexpr Color ORANGE_COLOR = Color(0XFF, 0X7A, 0X00);
constexpr Color ORANGE_SOFT_COLOR = Color(0XFF, 0XA0, 0X33);
constexpr Color ORANGE_SHADOW_COLOR = ORANGE_SOFT_COLOR.darken(100);
constexpr Color GREEN_COLOR = Color(0X5B, 0XEC, 0X95);
constexpr Color BLUE_SKY_COLOR = Color(0X02, 0X88, 0XD1);
constexpr Color PINK_SKY_COLOR = Color(0XFF, 0X6B, 0X97);
constexpr Color GREEN_SKY_COLOR = Color(0X00, 0X79, 0X6B);
constexpr Color SERV_MENU_TITLE_COLOR = Color(0x99, 0xFF, 0x62);
constexpr Color SERV_MENU_TEXT_COLOR = Color(255, 255, 255);
constexpr Color SERV_MENU_SELECTED_COLOR = Color(255, 170, 18).lighten();
//constexpr Color SERV_MENU_SELECTED_COLOR = SERV_MENU_TITLE_COLOR.darken();
constexpr Color SERV_MENU_BG_COLOR_SHADOW = Color(0x1E, 0x1E, 0x1E);
constexpr Color SERV_MENU_BG_COLOR_ALPHA = Color(0x00, 0x00, 0x00);
constexpr Color DEBUG_COLOR = Color(0xFF, 0xFF, 0x00);
// Colores y gráficos
Color getColorLikeKnightRider(const std::vector<Color> &colors, int counter_);
constexpr HSV rgbToHsv(Color color);
constexpr Color hsvToRgb(HSV hsv);
ColorCycle generateMirroredCycle(Color base, ColorCycleStyle style = ColorCycleStyle::SubtlePulse);
// Colisiones y geometría
double distanceSquared(int x1, int y1, int x2, int y2);