llevat soport per a colors amb nom

This commit is contained in:
2026-04-06 09:14:36 +02:00
parent c4a26ffa0f
commit cdf0665458
121 changed files with 676 additions and 5754 deletions

View File

@@ -5,34 +5,6 @@
#include <string> // Para string
#include <vector> // Para vector
enum class PaletteColor : Uint8 {
BLACK = 0,
BRIGHT_BLACK = 1,
BLUE = 2,
BRIGHT_BLUE = 3,
RED = 4,
BRIGHT_RED = 5,
MAGENTA = 6,
BRIGHT_MAGENTA = 7,
GREEN = 8,
BRIGHT_GREEN = 9,
CYAN = 10,
BRIGHT_CYAN = 11,
YELLOW = 12,
BRIGHT_YELLOW = 13,
WHITE = 14,
BRIGHT_WHITE = 15,
TRANSPARENT = 255,
};
// Estructura para definir un circulo
struct Circle {
int x{0};
@@ -92,8 +64,6 @@ auto toSDLRect(const SDL_FRect& frect) -> SDL_Rect; // Convierte SDL_FRect
auto toSDLPoint(const SDL_FPoint& fpoint) -> SDL_Point; // Convierte SDL_FPoint a SDL_Point
// CONVERSIONES DE STRING
auto stringToColor(const std::string& str) -> Uint8; // String a índice de paleta (acepta nombres o números)
auto colorToString(Uint8 index) -> std::string; // Índice de paleta a nombre canónico
auto safeStoi(const std::string& value, int default_value = 0) -> int; // String a int seguro (sin excepciones)
auto stringToBool(const std::string& str) -> bool; // String a bool (true/1/yes/on)
auto boolToString(bool value) -> std::string; // Bool a string (1/0)