Ya cambia la paleta de color de casi toda la habitación. Faltan los enemigos

This commit is contained in:
2022-10-26 10:09:48 +02:00
parent 674fdd1d05
commit bdce205006
5 changed files with 45 additions and 26 deletions

View File

@@ -20,8 +20,8 @@ Room::Room(std::string file, SDL_Renderer *renderer, Screen *screen, Asset *asse
mapWidth = 32;
mapHeight = 16;
paused = false;
itemColor1 = stringToColor(options->palette, "magenta");
itemColor2 = stringToColor(options->palette, "yellow");
itemColor1 = "magenta";
itemColor2 = "yellow";
autoSurfaceDirection = 1;
counter = 0;
@@ -57,7 +57,7 @@ Room::Room(std::string file, SDL_Renderer *renderer, Screen *screen, Asset *asse
fillMapTexture();
// Establece el color del borde
screen->setBorderColor(borderColor);
screen->setBorderColor(stringToColor(options->palette, borderColor));
}
// Destructor
@@ -130,8 +130,8 @@ bool Room::loadMapFile(std::string file_path)
item.asset = asset;
item.renderer = renderer;
item.counter = 0;
item.color1 = itemColor1;
item.color2 = itemColor2;
item.color1 = stringToColor(options->palette, itemColor1);
item.color2 = stringToColor(options->palette, itemColor2);
do
{
@@ -249,22 +249,22 @@ bool Room::setVars(std::string var, std::string value)
else if (var == "bgColor")
{
bgColor = stringToColor(options->palette, value);
bgColor = value;
}
else if (var == "border")
{
borderColor = stringToColor(options->palette, value);
borderColor = value;
}
else if (var == "itemColor1")
{
itemColor1 = stringToColor(options->palette, value);
itemColor1 = value;
}
else if (var == "itemColor2")
{
itemColor2 = stringToColor(options->palette, value);
itemColor2 = value;
}
else if (var == "tileset")
@@ -464,13 +464,13 @@ std::string Room::getName()
// Devuelve el color de la habitación
color_t Room::getBGColor()
{
return bgColor;
return stringToColor(options->palette, bgColor);
}
// Devuelve el color del borde
color_t Room::getBorderColor()
{
return borderColor;
return stringToColor(options->palette, borderColor);
}
// Crea la textura con el mapeado de la habitación
@@ -794,8 +794,14 @@ void Room::reLoadTexture()
// Recarga la paleta
void Room::reLoadPalette()
{
itemColor1 = stringToColor(options->palette, "magenta");
itemColor2 = stringToColor(options->palette, "yellow");
// Cambia el color de los items
for (auto item:items)
{
item->setColors(stringToColor(options->palette, itemColor1), stringToColor(options->palette, itemColor2));
}
// Establece el color del borde
screen->setBorderColor(stringToColor(options->palette, borderColor));
}
// Obten el tamaño del tile