forked from jaildesigner-jailgames/jaildoctors_dilemma
Mejoras en la presentación de la lista de logros
This commit is contained in:
152
source/title.cpp
152
source/title.cpp
@@ -66,16 +66,28 @@ Title::Title(SDL_Renderer *renderer, Screen *screen, Resource *resource, Asset *
|
||||
const vector<cheevos_t> cheevosList = cheevos->list();
|
||||
int pos = 2;
|
||||
const color_t cheevoLockedColor = stringToColor(options->palette, "white");
|
||||
const color_t cheevoUnlockedColor = stringToColor(options->palette, "white");
|
||||
const color_t cheevoUnlockedColor = stringToColor(options->palette, "bright_white");
|
||||
color_t cheevoColor;
|
||||
|
||||
Texture *iconTexture = new Texture(renderer, asset->get("notify.png"));
|
||||
const int iconSize = 16;
|
||||
Sprite *sp = new Sprite({0, 0, iconSize, iconSize}, iconTexture, renderer);
|
||||
for (auto cheevo : cheevosList)
|
||||
{
|
||||
cheevoColor = cheevo.completed ? cheevoUnlockedColor : cheevoLockedColor;
|
||||
infoText->writeColored(2, pos, cheevo.caption, cheevoColor);
|
||||
//const int iconIndex = cheevo.completed ? 3 : 2;
|
||||
sp->setPos({2, pos, iconSize, iconSize});
|
||||
sp->setSpriteClip({iconSize * 2, 0, iconSize, iconSize});
|
||||
sp->getTexture()->setColor(cheevoColor.r, cheevoColor.g, cheevoColor.b);
|
||||
sp->render();
|
||||
pos += 2;
|
||||
infoText->writeColored(2 + iconSize + 2, pos, cheevo.caption, cheevoColor);
|
||||
pos += 6;
|
||||
infoText->writeColored(2, pos, cheevo.description, cheevoColor);
|
||||
pos += 8;
|
||||
infoText->writeColored(2 + iconSize + 2, pos, cheevo.description, cheevoColor);
|
||||
pos += 9;
|
||||
}
|
||||
delete sp;
|
||||
delete iconTexture;
|
||||
|
||||
// Crea el sprite para el listado de logros
|
||||
cheevosSprite = new Sprite(4, 4, cheevosTexture->getWidth(), cheevosTexture->getHeight(), cheevosTexture, renderer);
|
||||
@@ -276,79 +288,79 @@ void Title::update()
|
||||
}
|
||||
}
|
||||
|
||||
// Dibuja en pantalla
|
||||
void Title::render()
|
||||
// Dibuja en pantalla
|
||||
void Title::render()
|
||||
{
|
||||
// Prepara para empezar a dibujar en la textura de juego
|
||||
screen->start();
|
||||
|
||||
// Dibuja el fondo del titulo
|
||||
sprite->render();
|
||||
|
||||
// Dibuja el texto de PRESS ENTER TO PLAY
|
||||
if (counter % 80 < 60)
|
||||
{
|
||||
// Prepara para empezar a dibujar en la textura de juego
|
||||
screen->start();
|
||||
|
||||
// Dibuja el fondo del titulo
|
||||
sprite->render();
|
||||
|
||||
// Dibuja el texto de PRESS ENTER TO PLAY
|
||||
if (counter % 80 < 60)
|
||||
{
|
||||
pressEnterSprite->render();
|
||||
}
|
||||
|
||||
// Dibuja la marquesina
|
||||
renderMarquee();
|
||||
|
||||
// Dibuja la linea de información inferior
|
||||
renderInfo();
|
||||
|
||||
// Dibuja la información de logros
|
||||
if (showCheevos)
|
||||
{
|
||||
cheevosSprite->render();
|
||||
}
|
||||
|
||||
// Vuelca el contenido del renderizador en pantalla
|
||||
screen->blit();
|
||||
pressEnterSprite->render();
|
||||
}
|
||||
|
||||
// Bucle para el logo del juego
|
||||
void Title::run()
|
||||
// Dibuja la marquesina
|
||||
renderMarquee();
|
||||
|
||||
// Dibuja la linea de información inferior
|
||||
renderInfo();
|
||||
|
||||
// Dibuja la información de logros
|
||||
if (showCheevos)
|
||||
{
|
||||
while (section->name == SECTION_PROG_TITLE)
|
||||
{
|
||||
update();
|
||||
render();
|
||||
}
|
||||
cheevosSprite->render();
|
||||
}
|
||||
|
||||
// Recarga las texturas
|
||||
void Title::reLoadTextures()
|
||||
{
|
||||
// Carga la textura adecuada
|
||||
if (options->palette == p_zxspectrum)
|
||||
{
|
||||
// texture->loadFromFile(asset->get("loading_screen_color.png"), renderer);
|
||||
texture = resource->getTexture("loading_screen_color.png");
|
||||
}
|
||||
else if (options->palette == p_zxarne)
|
||||
{
|
||||
// texture->loadFromFile(asset->get("loading_screen_color_zxarne.png"), renderer);
|
||||
texture = resource->getTexture("loading_screen_color_zxarne.png");
|
||||
}
|
||||
// Vuelca el contenido del renderizador en pantalla
|
||||
screen->blit();
|
||||
}
|
||||
|
||||
texture->reLoad();
|
||||
// Bucle para el logo del juego
|
||||
void Title::run()
|
||||
{
|
||||
while (section->name == SECTION_PROG_TITLE)
|
||||
{
|
||||
update();
|
||||
render();
|
||||
}
|
||||
}
|
||||
|
||||
// Recarga las texturas
|
||||
void Title::reLoadTextures()
|
||||
{
|
||||
// Carga la textura adecuada
|
||||
if (options->palette == p_zxspectrum)
|
||||
{
|
||||
// texture->loadFromFile(asset->get("loading_screen_color.png"), renderer);
|
||||
texture = resource->getTexture("loading_screen_color.png");
|
||||
}
|
||||
else if (options->palette == p_zxarne)
|
||||
{
|
||||
// texture->loadFromFile(asset->get("loading_screen_color_zxarne.png"), renderer);
|
||||
texture = resource->getTexture("loading_screen_color_zxarne.png");
|
||||
}
|
||||
|
||||
// Cambia la paleta
|
||||
void Title::switchPalette()
|
||||
{
|
||||
if (options->palette == p_zxspectrum)
|
||||
{
|
||||
options->palette = p_zxarne;
|
||||
sprite->setTexture(resource->getTexture("loading_screen_color_zxarne.png"));
|
||||
}
|
||||
else
|
||||
{
|
||||
options->palette = p_zxspectrum;
|
||||
sprite->setTexture(resource->getTexture("loading_screen_color.png"));
|
||||
}
|
||||
texture->reLoad();
|
||||
}
|
||||
|
||||
// Cambia el color del borde
|
||||
screen->setBorderColor(stringToColor(options->palette, "bright_blue"));
|
||||
}
|
||||
// Cambia la paleta
|
||||
void Title::switchPalette()
|
||||
{
|
||||
if (options->palette == p_zxspectrum)
|
||||
{
|
||||
options->palette = p_zxarne;
|
||||
sprite->setTexture(resource->getTexture("loading_screen_color_zxarne.png"));
|
||||
}
|
||||
else
|
||||
{
|
||||
options->palette = p_zxspectrum;
|
||||
sprite->setTexture(resource->getTexture("loading_screen_color.png"));
|
||||
}
|
||||
|
||||
// Cambia el color del borde
|
||||
screen->setBorderColor(stringToColor(options->palette, "bright_blue"));
|
||||
}
|
||||
Reference in New Issue
Block a user