Arreglado el cambio de paleta en el titulo
This commit is contained in:
@@ -9,7 +9,7 @@ Director::Director(std::string path)
|
||||
section.name = SECTION_PROG_LOGO;
|
||||
section.subsection = SUBSECTION_LOGO_TO_INTRO;
|
||||
|
||||
section.name = SECTION_PROG_LOGO;
|
||||
section.name = SECTION_PROG_TITLE;
|
||||
|
||||
// Crea el objeto que controla los ficheros de recursos
|
||||
asset = new Asset(path.substr(0, path.find_last_of("\\/")));
|
||||
|
||||
@@ -70,4 +70,19 @@ SDL_Point Item::getPos()
|
||||
void Item::reLoadTexture()
|
||||
{
|
||||
texture->reLoad();
|
||||
}
|
||||
|
||||
// Asigna los colores del objeto
|
||||
void Item::setColors(color_t col1, color_t col2)
|
||||
{
|
||||
// Reinicializa el vector de colores
|
||||
color.clear();
|
||||
|
||||
// Añade el primer color
|
||||
color.push_back(col1);
|
||||
color.push_back(col1);
|
||||
|
||||
// Añade el segundo color
|
||||
color.push_back(col2);
|
||||
color.push_back(col2);
|
||||
}
|
||||
@@ -59,8 +59,8 @@ public:
|
||||
// Recarga la textura
|
||||
void reLoadTexture();
|
||||
|
||||
// Recarga la paleta
|
||||
void reLoadPalette(palette_e pal);
|
||||
// Asigna los colores del objeto
|
||||
void setColors(color_t col1, color_t col2);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -812,7 +812,7 @@ int Room::getSlopeHeight(SDL_Point p, tile_e slope)
|
||||
debug->add("BASE = " + std::to_string(base));
|
||||
|
||||
// Calcula cuanto se ha entrado en el tile horizontalmente
|
||||
const int pos = (p.x % tileSize); // esto da un valor entre 0 y 7
|
||||
const int pos = (p.x % tileSize); // Esto da un valor entre 0 y 7
|
||||
debug->add("POS = " + std::to_string(pos));
|
||||
|
||||
// Se resta a la base la cantidad de pixeles pos en funcion de la rampa
|
||||
|
||||
@@ -82,27 +82,32 @@ void Title::checkEventHandler()
|
||||
|
||||
case SDL_SCANCODE_F:
|
||||
screen->switchVideoMode();
|
||||
texture->reLoad();
|
||||
reLoadTextures();
|
||||
break;
|
||||
|
||||
case SDL_SCANCODE_F1:
|
||||
screen->setWindowSize(1);
|
||||
texture->reLoad();
|
||||
reLoadTextures();
|
||||
break;
|
||||
|
||||
case SDL_SCANCODE_F2:
|
||||
screen->setWindowSize(2);
|
||||
texture->reLoad();
|
||||
reLoadTextures();
|
||||
break;
|
||||
|
||||
case SDL_SCANCODE_F3:
|
||||
screen->setWindowSize(3);
|
||||
texture->reLoad();
|
||||
reLoadTextures();
|
||||
break;
|
||||
|
||||
case SDL_SCANCODE_F4:
|
||||
screen->setWindowSize(4);
|
||||
texture->reLoad();
|
||||
reLoadTextures();
|
||||
break;
|
||||
|
||||
case SDL_SCANCODE_F5:
|
||||
switchPalette();
|
||||
reLoadTextures();
|
||||
break;
|
||||
|
||||
default:
|
||||
@@ -220,4 +225,34 @@ section_t Title::run()
|
||||
}
|
||||
|
||||
return section;
|
||||
}
|
||||
|
||||
// Recarga las texturas
|
||||
void Title::reLoadTextures()
|
||||
{
|
||||
// Carga la textura adecuada
|
||||
if (options->palette == p_zxspectrum)
|
||||
{
|
||||
texture->loadFromFile(asset->get("loading_screen_color.png"), renderer);
|
||||
}
|
||||
else if (options->palette == p_zxarne)
|
||||
{
|
||||
texture->loadFromFile(asset->get("loading_screen_color_zxarne.png"), renderer);
|
||||
}
|
||||
}
|
||||
|
||||
// Cambia la paleta
|
||||
void Title::switchPalette()
|
||||
{
|
||||
if (options->palette == p_zxspectrum)
|
||||
{
|
||||
options->palette = p_zxarne;
|
||||
}
|
||||
else
|
||||
{
|
||||
options->palette = p_zxspectrum;
|
||||
}
|
||||
|
||||
// Cambia el color del borde
|
||||
screen->setBorderColor(stringToColor(options->palette, "bright_blue"));
|
||||
}
|
||||
@@ -56,6 +56,12 @@ private:
|
||||
// Dibuja la marquesina
|
||||
void renderMarquee();
|
||||
|
||||
// Recarga las texturas
|
||||
void reLoadTextures();
|
||||
|
||||
// Cambia la paleta
|
||||
void switchPalette();
|
||||
|
||||
public:
|
||||
// Constructor
|
||||
Title(SDL_Renderer *renderer, Screen *screen, Asset *asset, options_t *options);
|
||||
|
||||
2
todo.txt
2
todo.txt
@@ -54,6 +54,8 @@ x (B) Así como no necesitar lo de frames per row
|
||||
x (C) Que no cree la ventana y luego añada el borde
|
||||
x (A) Las vidas del marcador no estan animadas. No cambian de frame
|
||||
(A) Mejorar las cintas. no permitir saltar hacia atras
|
||||
(A) Cambio de paleta en caliente
|
||||
(A) Precargar todos los recursos del juego
|
||||
|
||||
|
||||
## TEMAS
|
||||
|
||||
Reference in New Issue
Block a user