Implementado el cambio de paleta durante el juego
This commit is contained in:
@@ -291,7 +291,7 @@ void Screen::iniSpectrumFade()
|
||||
const std::vector<std::string> vColors = {"black", "blue", "red", "magenta", "green", "cyan", "yellow", "bright_white"};
|
||||
for (auto v : vColors)
|
||||
{
|
||||
spectrumColor.push_back(stringToColor(v));
|
||||
spectrumColor.push_back(stringToColor(options->palette, v));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -380,11 +380,9 @@ bool checkCollision(SDL_Point &p, d_line_t &l)
|
||||
}
|
||||
|
||||
// Devuelve un color_t a partir de un string
|
||||
color_t stringToColor(std::string str)
|
||||
color_t stringToColor(palette_e pal, std::string str)
|
||||
{
|
||||
const std::string palette = "spectrum";
|
||||
|
||||
if (palette == "spectrum")
|
||||
if (pal == p_zxspectrum)
|
||||
{
|
||||
if (str == "black")
|
||||
{
|
||||
@@ -467,7 +465,7 @@ color_t stringToColor(std::string str)
|
||||
}
|
||||
}
|
||||
|
||||
else
|
||||
else if (pal == p_zxarne)
|
||||
{ // zxarne
|
||||
if (str == "black")
|
||||
{
|
||||
|
||||
@@ -47,6 +47,13 @@ struct color_t
|
||||
Uint8 b;
|
||||
};
|
||||
|
||||
// Tipos de paleta
|
||||
enum palette_e
|
||||
{
|
||||
p_zxspectrum,
|
||||
p_zxarne
|
||||
};
|
||||
|
||||
// Estructura para saber la seccion y subseccion del programa
|
||||
struct section_t
|
||||
{
|
||||
@@ -67,6 +74,7 @@ struct options_t
|
||||
bool keepAspect; // Indica si se ha de mantener la relación de aspecto al poner el modo a pantalla completa
|
||||
bool borderEnabled; // Indica si ha de mostrar el borde en el modo de ventana
|
||||
float borderSize; // Porcentaje de borde que se añade a lo ventana
|
||||
palette_e palette; // Paleta de colores a usar en el juego
|
||||
};
|
||||
|
||||
// Calcula el cuadrado de la distancia entre dos puntos
|
||||
@@ -106,7 +114,7 @@ bool checkCollision(SDL_Point &p, d_line_t &l);
|
||||
void normalizeLine(d_line_t &l);
|
||||
|
||||
// Devuelve un color_t a partir de un string
|
||||
color_t stringToColor(std::string str);
|
||||
color_t stringToColor(palette_e pal, std::string str);
|
||||
|
||||
// Convierte una cadena en un valor booleano
|
||||
bool stringToBool(std::string str);
|
||||
|
||||
Reference in New Issue
Block a user