Añadida la paleta de spectrum
This commit is contained in:
227
source/utils.cpp
227
source/utils.cpp
@@ -143,70 +143,173 @@ bool checkCollision(SDL_Point &p, SDL_Rect &r)
|
||||
// Devuelve un color_t a partir de un string
|
||||
color_t stringToColor(std::string str)
|
||||
{
|
||||
color_t color = {0x00, 0x00, 0x00};
|
||||
if (str == "black")
|
||||
const std::string palette = "spectrum";
|
||||
|
||||
if (palette = "spectrum")
|
||||
{
|
||||
color = {0x00, 0x00, 0x00};
|
||||
if (str == "black")
|
||||
{
|
||||
return {0x00, 0x00, 0x00};
|
||||
}
|
||||
|
||||
else if (str == "light_black")
|
||||
{
|
||||
return {0x00, 0x00, 0x00};
|
||||
}
|
||||
|
||||
else if (str == "blue")
|
||||
{
|
||||
return {0x00, 0x00, 0xFF};
|
||||
}
|
||||
|
||||
else if (str == "light_blue")
|
||||
{
|
||||
return {0x00, 0x00, 0xEE};
|
||||
}
|
||||
|
||||
else if (str == "red")
|
||||
{
|
||||
return {0xFF, 0x00, 0x00};
|
||||
}
|
||||
|
||||
else if (str == "light_red")
|
||||
{
|
||||
return {0xEE, 0x00, 0x00};
|
||||
}
|
||||
|
||||
else if (str == "purple")
|
||||
{
|
||||
return {0xFF, 0x00, 0xFF};
|
||||
}
|
||||
|
||||
else if (str == "light_purple")
|
||||
{
|
||||
return {0xEE, 0x00, 0xEE};
|
||||
}
|
||||
|
||||
else if (str == "green")
|
||||
{
|
||||
return {0x00, 0xFF, 0x00};
|
||||
}
|
||||
|
||||
else if (str == "light_green")
|
||||
{
|
||||
return {0x00, 0xEE, 0x00};
|
||||
}
|
||||
|
||||
else if (str == "cyan")
|
||||
{
|
||||
return {0x00, 0xFF, 0xFF};
|
||||
}
|
||||
|
||||
else if (str == "light_cyan")
|
||||
{
|
||||
return {0x00, 0xEE, 0xEE};
|
||||
}
|
||||
|
||||
else if (str == "yellow")
|
||||
{
|
||||
return {0xFF, 0xFF, 0x00};
|
||||
}
|
||||
|
||||
else if (str == "light_yellow")
|
||||
{
|
||||
return {0xEE, 0xEE, 0x00};
|
||||
}
|
||||
|
||||
else if (str == "white")
|
||||
{
|
||||
return {0xEE, 0xEE, 0xEE};
|
||||
}
|
||||
|
||||
else if (str == "light_white")
|
||||
{
|
||||
return {0xFF, 0xFF, 0xFF};
|
||||
}
|
||||
}
|
||||
else if (str == "light_black")
|
||||
|
||||
else
|
||||
{
|
||||
color = {0x3C, 0x35, 0x1F};
|
||||
if (str == "black")
|
||||
{
|
||||
return {0x00, 0x00, 0x00};
|
||||
}
|
||||
|
||||
else if (str == "light_black")
|
||||
{
|
||||
return {0x3C, 0x35, 0x1F};
|
||||
}
|
||||
|
||||
else if (str == "blue")
|
||||
{
|
||||
return {0x31, 0x33, 0x90};
|
||||
}
|
||||
|
||||
else if (str == "light_blue")
|
||||
{
|
||||
return {0x15, 0x59, 0xDB};
|
||||
}
|
||||
|
||||
else if (str == "red")
|
||||
{
|
||||
return {0xA7, 0x32, 0x11};
|
||||
}
|
||||
|
||||
else if (str == "light_red")
|
||||
{
|
||||
return {0xD8, 0x55, 0x25};
|
||||
}
|
||||
|
||||
else if (str == "purple")
|
||||
{
|
||||
return {0xA1, 0x55, 0x89};
|
||||
}
|
||||
|
||||
else if (str == "light_purple")
|
||||
{
|
||||
return {0xCD, 0x7A, 0x50};
|
||||
}
|
||||
|
||||
else if (str == "green")
|
||||
{
|
||||
return {0x62, 0x9A, 0x31};
|
||||
}
|
||||
|
||||
else if (str == "light_green")
|
||||
{
|
||||
return {0x9C, 0xD3, 0x3C};
|
||||
}
|
||||
|
||||
else if (str == "cyan")
|
||||
{
|
||||
return {0x28, 0xA4, 0xCB};
|
||||
}
|
||||
|
||||
else if (str == "light_cyan")
|
||||
{
|
||||
return {0x65, 0xDC, 0xD6};
|
||||
}
|
||||
|
||||
else if (str == "yellow")
|
||||
{
|
||||
return {0xE8, 0xBC, 0x50};
|
||||
}
|
||||
|
||||
else if (str == "light_yellow")
|
||||
{
|
||||
return {0xF1, 0xE7, 0x82};
|
||||
}
|
||||
|
||||
else if (str == "white")
|
||||
{
|
||||
return {0xBF, 0xBF, 0xBD};
|
||||
}
|
||||
|
||||
else if (str == "light_white")
|
||||
{
|
||||
return {0xF2, 0xF1, 0xED};
|
||||
}
|
||||
}
|
||||
else if (str == "blue")
|
||||
{
|
||||
color = {0x31, 0x33, 0x90};
|
||||
}
|
||||
else if (str == "light_blue")
|
||||
{
|
||||
color = {0x15, 0x59, 0xDB};
|
||||
}
|
||||
else if (str == "red")
|
||||
{
|
||||
color = {0xA7, 0x32, 0x11};
|
||||
}
|
||||
else if (str == "light_red")
|
||||
{
|
||||
color = {0xD8, 0x55, 0x25};
|
||||
}
|
||||
else if (str == "purple")
|
||||
{
|
||||
color = {0xA1, 0x55, 0x89};
|
||||
}
|
||||
else if (str == "light_purple")
|
||||
{
|
||||
color = {0xCD, 0x7A, 0x50};
|
||||
}
|
||||
else if (str == "green")
|
||||
{
|
||||
color = {0x62, 0x9A, 0x31};
|
||||
}
|
||||
else if (str == "light_green")
|
||||
{
|
||||
color = {0x9C, 0xD3, 0x3C};
|
||||
}
|
||||
else if (str == "cyan")
|
||||
{
|
||||
color = {0x28, 0xA4, 0xCB};
|
||||
}
|
||||
else if (str == "light_cyan")
|
||||
{
|
||||
color = {0x65, 0xDC, 0xD6};
|
||||
}
|
||||
else if (str == "yellow")
|
||||
{
|
||||
color = {0xE8, 0xBC, 0x50};
|
||||
}
|
||||
else if (str == "light_yellow")
|
||||
{
|
||||
color = {0xF1, 0xE7, 0x82};
|
||||
}
|
||||
else if (str == "white")
|
||||
{
|
||||
color = {0xBF, 0xBF, 0xBD};
|
||||
}
|
||||
else if (str == "light_white")
|
||||
{
|
||||
color = {0xF2, 0xF1, 0xED};
|
||||
}
|
||||
return color;
|
||||
|
||||
return {0x00, 0x00, 0x00};
|
||||
}
|
||||
Reference in New Issue
Block a user