diff --git a/data/font/subatomic.png b/data/font/subatomic.png index fb9f09a..685fa77 100644 Binary files a/data/font/subatomic.png and b/data/font/subatomic.png differ diff --git a/data/font/subatomic.txt b/data/font/subatomic.txt index e35d286..69ffd71 100644 --- a/data/font/subatomic.txt +++ b/data/font/subatomic.txt @@ -1,7 +1,7 @@ # box width -6 +7 # box height -6 +7 # 32 espacio ( ) 4 # 33 ! diff --git a/source/director.cpp b/source/director.cpp index 82d8cb6..516bd82 100644 --- a/source/director.cpp +++ b/source/director.cpp @@ -499,18 +499,16 @@ void Director::loadResources(section_t *section) std::vector textureList; textureList.push_back("loading_screen_color.png"); textureList.push_back("loading_screen_color_zxarne.png"); - textureList.push_back("gauntlet.png"); textureList.push_back("smb2.png"); - textureList.push_back("debug.png"); + textureList.push_back("subatomic.png"); textureList.push_back("notify.png"); resource->loadTextures(textureList); // Offsets std::vector offsetsList; - offsetsList.push_back("gauntlet.txt"); offsetsList.push_back("smb2.txt"); - offsetsList.push_back("debug.txt"); + offsetsList.push_back("subatomic.txt"); resource->loadOffsets(offsetsList); } @@ -1384,6 +1382,8 @@ bool Director::setFileList() asset->add(prefix + "/data/font/debug.txt", 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/subatomic.png", t_font); + asset->add(prefix + "/data/font/subatomic.txt", t_font); // Datos asset->add(prefix + "/data/input/gamecontrollerdb.txt", t_data); diff --git a/source/title.cpp b/source/title.cpp index 6967348..a4954bb 100644 --- a/source/title.cpp +++ b/source/title.cpp @@ -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); 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 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 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; if (cheevosTextureView.y < 0) @@ -424,13 +425,15 @@ void Title::createCheevosTexture() { // Crea la textura con el listado de logros const std::vector cheevosList = cheevos->list(); - 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 iconSize = 16; // Altura del icono que representa a cada logro const int cheevosTextureWidth = 200; const int cheevosTextureViewHeight = 110; 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->createBlank(renderer, cheevosTextureWidth, cheevoHeight * cheevosList.size(), SDL_TEXTUREACCESS_TARGET); + cheevosTexture->createBlank(renderer, cheevosTextureWidth, cheevosTextureHeight, SDL_TEXTUREACCESS_TARGET); cheevosTexture->setAsRenderTarget(renderer); cheevosTexture->setBlendMode(SDL_BLENDMODE_BLEND); @@ -442,8 +445,9 @@ void Title::createCheevosTexture() // 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 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 = 11; + int pos = 2; + 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 cheevoUnlockedColor = stringToColor(options->palette, "bright_green"); color_t cheevoColor; @@ -451,26 +455,28 @@ void Title::createCheevosTexture() const int lineX1 = (cheevosTextureWidth / 7) * 3; const int lineX2 = lineX1 + ((cheevosTextureWidth / 7) * 1); - Texture *iconTexture = new Texture(renderer, asset->get("notify.png")); - Sprite *sp = new Sprite({0, 0, iconSize, iconSize}, iconTexture, renderer); + // Texture *iconTexture = new Texture(renderer, asset->get("notify.png")); + // Sprite *sp = new Sprite({0, 0, iconSize, iconSize}, iconTexture, renderer); for (auto cheevo : cheevosList) { cheevoColor = cheevo.completed ? cheevoUnlockedColor : cheevoLockedColor; - 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; - SDL_RenderDrawLine(renderer, lineX1, pos - 3, lineX2, pos - 3); + // 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 += cheevosPadding; + 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->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->writeDX(TXT_CENTER | TXT_COLOR, cheevosTextureWidth / 2, pos, cheevo.description, 1, cheevoColor); - pos += 9; + // pos += cheevosPadding; + pos += infoText->getCharacterSize(); } - delete sp; - delete iconTexture; + // delete sp; + // delete iconTexture; // 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);