From 62d90a605f57301f4f44d5efdc4f6cc08e74d5ab Mon Sep 17 00:00:00 2001 From: Sergio Date: Mon, 9 Oct 2023 10:25:36 +0200 Subject: [PATCH] Modificada la fuente subatomic Modificado el aspecto y el comportamiento del menu de logros --- data/font/subatomic.png | Bin 867 -> 902 bytes data/font/subatomic.txt | 4 ++-- source/director.cpp | 8 ++++---- source/title.cpp | 44 +++++++++++++++++++++++----------------- 4 files changed, 31 insertions(+), 25 deletions(-) diff --git a/data/font/subatomic.png b/data/font/subatomic.png index fb9f09a4b90797f40df56478b9ebc16596434dca..685fa7745da1dc46f9be35a74a540e471c2dcfba 100644 GIT binary patch literal 902 zcmV;119|+3P)Px&KuJVFRCt{2ThW&5APCf+{Qoa!U)I*LFbqV~r0cvzG6;e|diRzBu4@G*8Wn?*vZ(K;j;V@c+5~L10)Z=)>=y`rT(Jlw&(u6{<+p#BZnjP$i3JAo)r)c zs__lTK@W|q>F6ES^jrHjo)yT94@hp=sRfKVrz~#@WI0163T3QU`dC{sa#RhXHcZ74 zBTx{m;K`sMZq$w$@{xhNM8H1@w(rc`YvIe`Hf_}8y#}xGkW9W4Y1Y{$@A-%9%mNK7 z6q$XF^oB@XX9kLhe)KLov_$t{_m}Hdzux+nBGL7}S27vu*>E)LrGDuHk|8~;9P!+< zXB#VYM)QwxX z8DP2dnsK&NycsZ==W#8WR&Jxe84lIST+zr7@o5>dGb>~FLwZ<$B(_ps<0kuI$tY(J z0A)|4xgtB6VMXK5=r7)RYSUb$tRIU4M!4;DO|BPFw8%Z`h^Q_+#q zx=He&*uLZOEM$2jbZXTrdX5VV3n64Ds`lJqt!uS>1W($DWEubZQl8;iGS3I;^B6SoYX(eWXm#J~E18~z);%9Gb{>Kkj58n`X-1aOi4OZL zJCXct1V1w%SHZr&{(a;x7I@2ZyM^yMQG_T%^<6Q?4T)kltAnoMscU6X|@k#mpqrIM%P{ z+Iri|YQ79lv&HhE>AAuL=lwcv;n9=ln05}lU(QGOkW%!-=mU{Weu>S0Wh~IRTnaa4 zN6>T7fg(FCSu_ABc(=JItdX~H<^ZIBr{AOn8>qr8TpaMPHWx02Z?E&W#|qH3vC7@T c!ookn58NE@(9rj$s{jB107*qoM6N<$g4imZ00001b5ch_0Itp) z=>Px&9Z5t%RA_)Vuz#Vx<$Esct6rbUy_N>ut4K9RncS1UR*_Mm_(6>mW+TJ^(f zrF;vxSYO#7xu5TNk1Es0p7Il|n(EI{58Wk?xM$^&e`e2e!u%Yq;T5t*QN>3=)b5Dn z89vcD;O$nm1C<|-V;GdLDve*EED0o!4n!5NBCqm9P`ok+>A+DvQ7!50iHjy#T_mNC zP}RTU$9IHmULNc~^-vnm14xE!XZ0-~Ca>_1J}Z6{&*s6DP-3o3Y*vo=X5OobzQPUp z@OZm*SjEi!k_Ft+yLW@lSLGp_pReBx)yW!FnbjRYgqXhalZ~x-XOn@7Eu)_zRNZ>x znY9)cBhvRR%j>H+Gx}&w$_~9Fu8hZR_|f3M0W1M(WhzOlCiu#NRJMF}XUyb)j#ZqY zZ5JV0Oh2(G5g9*BKQq@XpDC!M?tq$D^jz`77IGIKHum*XR`n|P7r^GDzDDoja@ZGk zpUwd3t3^{WhTPg)eI`f#E5&2~R*}(vFo_ktnA&H0-wvolX2k*YQ&q|O_zMXmM<@}Q z#CbXT_BXb=-|qHsQ=HhOk*x9@eMWfM$z=>$(|?yxiCeKP*#e-&*?F*6FAwsktlh9l z8ZxyY>IQ*)&2mC~vN>Y>52U;j?6!d3y*#r6{EqT*QB2mxD#fOf|Eq2<)g=BUurukw t4M_dV)`Nw3O8o{rN#2jAbv*cA_y7mT^V~|;Q>_31002ovPDHLkV1gqAtStZl diff --git a/data/font/subatomic.txt b/data/font/subatomic.txt index e35d2861..69ffd714 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 82d8cb65..516bd828 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 69673487..a4954bbe 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);