Mejoras en la presentación de la lista de logros
This commit is contained in:
@@ -501,6 +501,7 @@ void Director::loadResources(section_t *section)
|
|||||||
textureList.push_back("loading_screen_color_zxarne.png");
|
textureList.push_back("loading_screen_color_zxarne.png");
|
||||||
textureList.push_back("smb2.png");
|
textureList.push_back("smb2.png");
|
||||||
textureList.push_back("debug.png");
|
textureList.push_back("debug.png");
|
||||||
|
textureList.push_back("notify.png");
|
||||||
|
|
||||||
resource->loadTextures(textureList);
|
resource->loadTextures(textureList);
|
||||||
|
|
||||||
|
|||||||
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();
|
const vector<cheevos_t> cheevosList = cheevos->list();
|
||||||
int pos = 2;
|
int pos = 2;
|
||||||
const color_t cheevoLockedColor = stringToColor(options->palette, "white");
|
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;
|
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)
|
for (auto cheevo : cheevosList)
|
||||||
{
|
{
|
||||||
cheevoColor = cheevo.completed ? cheevoUnlockedColor : cheevoLockedColor;
|
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;
|
pos += 6;
|
||||||
infoText->writeColored(2, pos, cheevo.description, cheevoColor);
|
infoText->writeColored(2 + iconSize + 2, pos, cheevo.description, cheevoColor);
|
||||||
pos += 8;
|
pos += 9;
|
||||||
}
|
}
|
||||||
|
delete sp;
|
||||||
|
delete iconTexture;
|
||||||
|
|
||||||
// Crea el sprite para el listado de logros
|
// Crea el sprite para el listado de logros
|
||||||
cheevosSprite = new Sprite(4, 4, cheevosTexture->getWidth(), cheevosTexture->getHeight(), cheevosTexture, renderer);
|
cheevosSprite = new Sprite(4, 4, cheevosTexture->getWidth(), cheevosTexture->getHeight(), cheevosTexture, renderer);
|
||||||
@@ -276,79 +288,79 @@ void Title::update()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Dibuja en pantalla
|
// Dibuja en pantalla
|
||||||
void Title::render()
|
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
|
pressEnterSprite->render();
|
||||||
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();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Bucle para el logo del juego
|
// Dibuja la marquesina
|
||||||
void Title::run()
|
renderMarquee();
|
||||||
|
|
||||||
|
// Dibuja la linea de información inferior
|
||||||
|
renderInfo();
|
||||||
|
|
||||||
|
// Dibuja la información de logros
|
||||||
|
if (showCheevos)
|
||||||
{
|
{
|
||||||
while (section->name == SECTION_PROG_TITLE)
|
cheevosSprite->render();
|
||||||
{
|
|
||||||
update();
|
|
||||||
render();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Recarga las texturas
|
// Vuelca el contenido del renderizador en pantalla
|
||||||
void Title::reLoadTextures()
|
screen->blit();
|
||||||
{
|
}
|
||||||
// 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");
|
|
||||||
}
|
|
||||||
|
|
||||||
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
|
texture->reLoad();
|
||||||
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
|
// Cambia la paleta
|
||||||
screen->setBorderColor(stringToColor(options->palette, "bright_blue"));
|
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