forked from jaildesigner-jailgames/jaildoctors_dilemma
Trabajando para que el cambio de paleta sea en tiempo real
This commit is contained in:
@@ -123,55 +123,6 @@ bool Room::loadMapFile(std::string file_path)
|
||||
enemies.push_back(new Enemy(enemy));
|
||||
}
|
||||
|
||||
// Si la linea contiene el texto [tilemap] se realiza el proceso de carga del fichero tmx
|
||||
/*else if (line == "[tilemap]")
|
||||
{
|
||||
do
|
||||
{
|
||||
std::getline(file, line);
|
||||
if (line.find(".tmx") != std::string::npos)
|
||||
{
|
||||
std::string filename2 = line;
|
||||
std::ifstream file2(asset->get(filename2)); // Abre el fichero tmx
|
||||
if (file2.good())
|
||||
{
|
||||
bool data_read = false;
|
||||
while (std::getline(file2, line)) // Lee el fichero linea a linea
|
||||
{
|
||||
if (!data_read)
|
||||
{ // Lee lineas hasta que encuentre donde empiezan los datos del mapa
|
||||
int pos = 0;
|
||||
do
|
||||
{
|
||||
std::getline(file2, line);
|
||||
pos = line.find("data encoding");
|
||||
} while (pos == std::string::npos);
|
||||
|
||||
do
|
||||
{ // Se introducen los valores separados por comas en un vector
|
||||
data_read = true;
|
||||
std::getline(file2, line);
|
||||
if (line != "</data>")
|
||||
{
|
||||
std::stringstream ss(line);
|
||||
std::string tmp;
|
||||
while (getline(ss, tmp, ','))
|
||||
{ // Se resta 1 ya que tiled numera los tiles de 1 a n
|
||||
tilemap.push_back(std::stoi(tmp) - 1);
|
||||
}
|
||||
}
|
||||
} while (line != "</data>");
|
||||
}
|
||||
}
|
||||
|
||||
// Cierra el fichero
|
||||
printf("Closing file %s\n\n", filename2.c_str());
|
||||
file2.close();
|
||||
}
|
||||
}
|
||||
} while (line != "[/tilemap]");
|
||||
}*/
|
||||
|
||||
// Si la linea contiene el texto [item] se realiza el proceso de carga de un item
|
||||
else if (line == "[item]")
|
||||
{
|
||||
@@ -840,6 +791,13 @@ void Room::reLoadTexture()
|
||||
}
|
||||
}
|
||||
|
||||
// Recarga la paleta
|
||||
void Room::reLoadPalette()
|
||||
{
|
||||
itemColor1 = stringToColor(options->palette, "magenta");
|
||||
itemColor2 = stringToColor(options->palette, "yellow");
|
||||
}
|
||||
|
||||
// Obten el tamaño del tile
|
||||
int Room::getTileSize()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user