canvi de pc
This commit is contained in:
@@ -358,76 +358,6 @@ bool checkCollision(const SDL_Point &p, const LineDiagonal &l)
|
||||
return true;
|
||||
}
|
||||
|
||||
// Convierte una cadena a un color
|
||||
Color stringToColor(Palette pal, const std::string &str)
|
||||
{
|
||||
// Mapas de colores para cada paleta
|
||||
static const std::unordered_map<std::string, Color> zxSpectrumColors = {
|
||||
{"black", {0x00, 0x00, 0x00}},
|
||||
{"bright_black", {0x00, 0x00, 0x00}},
|
||||
{"blue", {0x00, 0x00, 0xD8}},
|
||||
{"bright_blue", {0x00, 0x00, 0xFF}},
|
||||
{"red", {0xD8, 0x00, 0x00}},
|
||||
{"bright_red", {0xFF, 0x00, 0x00}},
|
||||
{"magenta", {0xD8, 0x00, 0xD8}},
|
||||
{"bright_magenta", {0xFF, 0x00, 0xFF}},
|
||||
{"green", {0x00, 0xD8, 0x00}},
|
||||
{"bright_green", {0x00, 0xFF, 0x00}},
|
||||
{"cyan", {0x00, 0xD8, 0xD8}},
|
||||
{"bright_cyan", {0x00, 0xFF, 0xFF}},
|
||||
{"yellow", {0xD8, 0xD8, 0x00}},
|
||||
{"bright_yellow", {0xFF, 0xFF, 0x00}},
|
||||
{"white", {0xD8, 0xD8, 0xD8}},
|
||||
{"bright_white", {0xFF, 0xFF, 0xFF}}};
|
||||
|
||||
static const std::unordered_map<std::string, Color> zxArneColors = {
|
||||
{"black", {0x00, 0x00, 0x00}},
|
||||
{"bright_black", {0x3C, 0x35, 0x1F}},
|
||||
{"blue", {0x31, 0x33, 0x90}},
|
||||
{"bright_blue", {0x15, 0x59, 0xDB}},
|
||||
{"red", {0xA7, 0x32, 0x11}},
|
||||
{"bright_red", {0xD8, 0x55, 0x25}},
|
||||
{"magenta", {0xA1, 0x55, 0x89}},
|
||||
{"bright_magenta", {0xCD, 0x7A, 0x50}},
|
||||
{"green", {0x62, 0x9A, 0x31}},
|
||||
{"bright_green", {0x9C, 0xD3, 0x3C}},
|
||||
{"cyan", {0x28, 0xA4, 0xCB}},
|
||||
{"bright_cyan", {0x65, 0xDC, 0xD6}},
|
||||
{"yellow", {0xE8, 0xBC, 0x50}},
|
||||
{"bright_yellow", {0xF1, 0xE7, 0x82}},
|
||||
{"white", {0xBF, 0xBF, 0xBD}},
|
||||
{"bright_white", {0xF2, 0xF1, 0xED}}};
|
||||
|
||||
// Selecciona el mapa de colores adecuado según la paleta
|
||||
const std::unordered_map<std::string, Color> *paletteMap = nullptr;
|
||||
|
||||
if (pal == Palette::ZXSPECTRUM)
|
||||
{
|
||||
paletteMap = &zxSpectrumColors;
|
||||
}
|
||||
else if (pal == Palette::ZXARNE)
|
||||
{
|
||||
paletteMap = &zxArneColors;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Paleta desconocida, devolvemos negro por defecto
|
||||
return {0x00, 0x00, 0x00};
|
||||
}
|
||||
|
||||
// Busca el color en el mapa
|
||||
auto it = paletteMap->find(str);
|
||||
if (it != paletteMap->end())
|
||||
{
|
||||
return it->second;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Si no se encuentra el color, devolvemos negro por defecto
|
||||
return {0x00, 0x00, 0x00};
|
||||
}
|
||||
}
|
||||
|
||||
// Convierte una cadena a un indice de la paleta
|
||||
Uint8 stringToColor(const std::string &str)
|
||||
{
|
||||
@@ -460,7 +390,7 @@ Uint8 stringToColor(const std::string &str)
|
||||
else
|
||||
{
|
||||
// Si no se encuentra el color, devolvemos negro por defecto
|
||||
return {0};
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user