Modificada la fuente subatomic

Modificado el aspecto y el comportamiento del menu de logros
This commit is contained in:
2023-10-09 10:25:36 +02:00
parent d718e20767
commit 62d90a605f
4 changed files with 31 additions and 25 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 867 B

After

Width:  |  Height:  |  Size: 902 B

View File

@@ -1,7 +1,7 @@
# box width # box width
6 7
# box height # box height
6 7
# 32 espacio ( ) # 32 espacio ( )
4 4
# 33 ! # 33 !

View File

@@ -499,18 +499,16 @@ void Director::loadResources(section_t *section)
std::vector<std::string> textureList; std::vector<std::string> textureList;
textureList.push_back("loading_screen_color.png"); textureList.push_back("loading_screen_color.png");
textureList.push_back("loading_screen_color_zxarne.png"); textureList.push_back("loading_screen_color_zxarne.png");
textureList.push_back("gauntlet.png");
textureList.push_back("smb2.png"); textureList.push_back("smb2.png");
textureList.push_back("debug.png"); textureList.push_back("subatomic.png");
textureList.push_back("notify.png"); textureList.push_back("notify.png");
resource->loadTextures(textureList); resource->loadTextures(textureList);
// Offsets // Offsets
std::vector<std::string> offsetsList; std::vector<std::string> offsetsList;
offsetsList.push_back("gauntlet.txt");
offsetsList.push_back("smb2.txt"); offsetsList.push_back("smb2.txt");
offsetsList.push_back("debug.txt"); offsetsList.push_back("subatomic.txt");
resource->loadOffsets(offsetsList); resource->loadOffsets(offsetsList);
} }
@@ -1384,6 +1382,8 @@ bool Director::setFileList()
asset->add(prefix + "/data/font/debug.txt", t_font); asset->add(prefix + "/data/font/debug.txt", t_font);
asset->add(prefix + "/data/font/gauntlet.png", t_font); asset->add(prefix + "/data/font/gauntlet.png", t_font);
asset->add(prefix + "/data/font/gauntlet.txt", t_font); asset->add(prefix + "/data/font/gauntlet.txt", t_font);
asset->add(prefix + "/data/font/subatomic.png", t_font);
asset->add(prefix + "/data/font/subatomic.txt", t_font);
// Datos // Datos
asset->add(prefix + "/data/input/gamecontrollerdb.txt", t_data); asset->add(prefix + "/data/input/gamecontrollerdb.txt", t_data);

View File

@@ -25,7 +25,7 @@ Title::Title(SDL_Renderer *renderer, Screen *screen, Resource *resource, Asset *
} }
sprite = new Sprite(0, 0, texture->getWidth(), texture->getHeight(), texture, renderer); sprite = new Sprite(0, 0, texture->getWidth(), texture->getHeight(), texture, renderer);
text = new Text(resource->getOffset("smb2.txt"), resource->getTexture("smb2.png"), renderer); text = new Text(resource->getOffset("smb2.txt"), resource->getTexture("smb2.png"), renderer);
infoText = new Text(resource->getOffset("debug.txt"), resource->getTexture("debug.png"), renderer); infoText = new Text(resource->getOffset("subatomic.txt"), resource->getTexture("subatomic.png"), renderer);
// Crea la textura para los graficos que aparecen en el fondo de la pantalla de titulo // Crea la textura para los graficos que aparecen en el fondo de la pantalla de titulo
bgTexture = SDL_CreateTexture(renderer, SDL_PIXELFORMAT_RGBA8888, SDL_TEXTUREACCESS_TARGET, GAMECANVAS_WIDTH, GAMECANVAS_HEIGHT); bgTexture = SDL_CreateTexture(renderer, SDL_PIXELFORMAT_RGBA8888, SDL_TEXTUREACCESS_TARGET, GAMECANVAS_WIDTH, GAMECANVAS_HEIGHT);
@@ -348,7 +348,8 @@ void Title::switchPalette()
// Desplaza la lista de logros // Desplaza la lista de logros
void Title::moveCheevosList(int direction) void Title::moveCheevosList(int direction)
{ {
cheevosTextureView.y = direction == 0 ? cheevosTextureView.y - 1 : cheevosTextureView.y + 1; const int speed = 2;
cheevosTextureView.y = direction == 0 ? cheevosTextureView.y - speed : cheevosTextureView.y + speed;
const int bottom = cheevosTexture->getHeight() - cheevosTextureView.h; const int bottom = cheevosTexture->getHeight() - cheevosTextureView.h;
if (cheevosTextureView.y < 0) if (cheevosTextureView.y < 0)
@@ -424,13 +425,15 @@ void Title::createCheevosTexture()
{ {
// Crea la textura con el listado de logros // Crea la textura con el listado de logros
const std::vector<cheevos_t> cheevosList = cheevos->list(); const std::vector<cheevos_t> cheevosList = cheevos->list();
const int iconSize = 16; // Altura del icono que representa a cada logro // const int iconSize = 16; // Altura del icono que representa a cada logro
const int cheevoHeight = iconSize + 2; // EL espacio que ocupa cada logro es igual a la altura del icono mas dos pixeles de separación
const int cheevosTextureWidth = 200; const int cheevosTextureWidth = 200;
const int cheevosTextureViewHeight = 110; const int cheevosTextureViewHeight = 110;
const int cheevosTexturePosY = 73; const int cheevosTexturePosY = 73;
const int cheevosPadding = 10;
const int cheevoHeight = cheevosPadding + (infoText->getCharacterSize() * 2) + 1;
const int cheevosTextureHeight = (cheevoHeight * cheevosList.size()) + 2 + infoText->getCharacterSize() + 8;
cheevosTexture = new Texture(renderer); cheevosTexture = new Texture(renderer);
cheevosTexture->createBlank(renderer, cheevosTextureWidth, cheevoHeight * cheevosList.size(), SDL_TEXTUREACCESS_TARGET); cheevosTexture->createBlank(renderer, cheevosTextureWidth, cheevosTextureHeight, SDL_TEXTUREACCESS_TARGET);
cheevosTexture->setAsRenderTarget(renderer); cheevosTexture->setAsRenderTarget(renderer);
cheevosTexture->setBlendMode(SDL_BLENDMODE_BLEND); cheevosTexture->setBlendMode(SDL_BLENDMODE_BLEND);
@@ -442,8 +445,9 @@ void Title::createCheevosTexture()
// Escribe la lista de logros en la textura // Escribe la lista de logros en la textura
const std::string cheevosOwner = options->online.jailerID == "" ? "LOCAL ACHIEVEMENTS" : "ACHIEVEMENTS FOR " + toUpper(options->online.jailerID); const std::string cheevosOwner = options->online.jailerID == "" ? "LOCAL ACHIEVEMENTS" : "ACHIEVEMENTS FOR " + toUpper(options->online.jailerID);
const std::string cheevosListCaption = cheevosOwner + " (" + std::to_string(cheevos->unlocked()) + " / " + std::to_string(cheevos->count()) + ")"; const std::string cheevosListCaption = cheevosOwner + " (" + std::to_string(cheevos->unlocked()) + " / " + std::to_string(cheevos->count()) + ")";
infoText->writeDX(TXT_CENTER | TXT_COLOR, cheevosTexture->getWidth() / 2, 2, cheevosListCaption, 1, stringToColor(options->palette, "bright_green")); int pos = 2;
int pos = 11; infoText->writeDX(TXT_CENTER | TXT_COLOR, cheevosTexture->getWidth() / 2, pos, cheevosListCaption, 1, stringToColor(options->palette, "bright_green"));
pos += infoText->getCharacterSize();
const color_t cheevoLockedColor = stringToColor(options->palette, "white"); const color_t cheevoLockedColor = stringToColor(options->palette, "white");
const color_t cheevoUnlockedColor = stringToColor(options->palette, "bright_green"); const color_t cheevoUnlockedColor = stringToColor(options->palette, "bright_green");
color_t cheevoColor; color_t cheevoColor;
@@ -451,26 +455,28 @@ void Title::createCheevosTexture()
const int lineX1 = (cheevosTextureWidth / 7) * 3; const int lineX1 = (cheevosTextureWidth / 7) * 3;
const int lineX2 = lineX1 + ((cheevosTextureWidth / 7) * 1); const int lineX2 = lineX1 + ((cheevosTextureWidth / 7) * 1);
Texture *iconTexture = new Texture(renderer, asset->get("notify.png")); // Texture *iconTexture = new Texture(renderer, asset->get("notify.png"));
Sprite *sp = new Sprite({0, 0, iconSize, iconSize}, iconTexture, renderer); // 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;
sp->setPos({2, pos, iconSize, iconSize}); // sp->setPos({2, pos, iconSize, iconSize});
sp->setSpriteClip({iconSize * 2, 0, iconSize, iconSize}); // sp->setSpriteClip({iconSize * 2, 0, iconSize, iconSize});
sp->getTexture()->setColor(cheevoColor.r, cheevoColor.g, cheevoColor.b); // sp->getTexture()->setColor(cheevoColor.r, cheevoColor.g, cheevoColor.b);
// sp->render(); // sp->render();
pos += 2; pos += cheevosPadding;
SDL_RenderDrawLine(renderer, lineX1, pos - 3, lineX2, pos - 3); int half = cheevosPadding / 2;
SDL_RenderDrawLine(renderer, lineX1, pos - half - 1, lineX2, pos - half - 1);
// infoText->writeColored(2 + iconSize + 2, pos, cheevo.caption, cheevoColor); // infoText->writeColored(2 + iconSize + 2, pos, cheevo.caption, cheevoColor);
infoText->writeDX(TXT_CENTER | TXT_COLOR, cheevosTextureWidth / 2, pos, cheevo.caption, 1, cheevoColor); infoText->writeDX(TXT_CENTER | TXT_COLOR, cheevosTextureWidth / 2, pos, cheevo.caption, 1, cheevoColor);
pos += 6; pos += infoText->getCharacterSize() + 1;
// infoText->writeColored(2 + iconSize + 2, pos, cheevo.description, cheevoColor); // infoText->writeColored(2 + iconSize + 2, pos, cheevo.description, cheevoColor);
infoText->writeDX(TXT_CENTER | TXT_COLOR, cheevosTextureWidth / 2, pos, cheevo.description, 1, cheevoColor); infoText->writeDX(TXT_CENTER | TXT_COLOR, cheevosTextureWidth / 2, pos, cheevo.description, 1, cheevoColor);
pos += 9; // pos += cheevosPadding;
pos += infoText->getCharacterSize();
} }
delete sp; // delete sp;
delete iconTexture; // delete iconTexture;
// Crea el sprite para el listado de logros // Crea el sprite para el listado de logros
// cheevosSprite = new Sprite((GAMECANVAS_WIDTH - cheevosTexture->getWidth()) / 2, (GAMECANVAS_HEIGHT - cheevosTextureViewHeight) / 2, cheevosTexture->getWidth(), cheevosTexture->getHeight(), cheevosTexture, renderer); // cheevosSprite = new Sprite((GAMECANVAS_WIDTH - cheevosTexture->getWidth()) / 2, (GAMECANVAS_HEIGHT - cheevosTextureViewHeight) / 2, cheevosTexture->getWidth(), cheevosTexture->getHeight(), cheevosTexture, renderer);