From d2e94ce74bc4976e7e4b3a4b0826029787a7d679 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sergio=20Valor=20Mart=C3=ADnez?= Date: Sun, 28 May 2023 19:35:49 +0200 Subject: [PATCH] =?UTF-8?q?on=5Fscreen=5Fkeyboard:=20Mejorada=20la=20calid?= =?UTF-8?q?ad=20del=20cursor=20on=5Fscreen=5Fkeyboard:=20Compatibilidad=20?= =?UTF-8?q?con=20fuentes=20de=20texto=20de=20tama=C3=B1o=20variable?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- data/8bithud.png | Bin 1094 -> 0 bytes data/nokia.png | Bin 0 -> 1208 bytes data/{8bithud.txt => nokia.txt} | 130 ++++++++++++++++---------------- main.cpp | 4 +- units/on_screen_keyboard.cpp | 7 +- 5 files changed, 74 insertions(+), 67 deletions(-) delete mode 100644 data/8bithud.png create mode 100644 data/nokia.png rename data/{8bithud.txt => nokia.txt} (89%) diff --git a/data/8bithud.png b/data/8bithud.png deleted file mode 100644 index 2ac5e4c8d74520242b2fb7a2bcf709bd8fc9a0e7..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1094 zcmV-M1iAZ(P)Px(07*naRCt{2o7t9PF$hJ~<^TWk?H5xE5jcmCsMlscl|l#^7*f@Jxd4s_NXPow zvfhpT_qdRiy5p+oojAhM0dTk`RJWapbNLHU3$m*>sV z8)eDlcgJxYTF3hA9fUjpZOij%CFp`j-@k+M0Y`_+vMPctdpi$T+qdRIrHPS!bB1_w zFmhIYZ>3o&i!MZVBbd#LbgB_tJv=lXMsU>ul%lIxDLUgXss(-(ua zvAff1^8voP&YYN+#zaStx9O3d*YH^5SvmS#wZB{LWhEr9a%UBz1x1mEE)092SpTx} z?1i3{SDC#C_sZZw)Yvc!UZIn{IN7yk=V#|({D{uS%bWu`f~!OeiBkHi3{Z_QZ~Tf3 zG`fFJX3gWxuet560slLwc|;e2dB#O^&=Fj%E#A#vZMUkI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 ^ -4 +3 # 95 _ 6 # 96 ` @@ -137,27 +137,27 @@ # 98 b 5 # 99 c -5 +4 # 100 d 5 # 101 e 5 # 102 f -5 +3 # 103 g 5 # 104 h 5 # 105 i -4 +2 # 106 j -5 +3 # 107 k 5 # 108 l -5 +2 # 109 m -6 +8 # 110 n 5 # 111 o @@ -167,28 +167,28 @@ # 113 q 5 # 114 r -5 -# 115 s -5 -# 116 t 4 +# 115 s +4 +# 116 t +3 # 117 u 5 # 118 v 5 # 119 w -6 +7 # 120 x -4 +5 # 121 y -4 +5 # 122 z 5 -# 123 { -3 -# 124 | -2 +# 123 { -> ñ +5 +# 124 | -> ç +5 # 125 } -3 +0 # 126 ~ -3 \ No newline at end of file +0 \ No newline at end of file diff --git a/main.cpp b/main.cpp index b0ef3e7..f4a5580 100644 --- a/main.cpp +++ b/main.cpp @@ -165,6 +165,8 @@ void initAsset(char *argv[]) asset->add("/data/smb2.png", t_bitmap); asset->add("/data/debug.txt", t_font); asset->add("/data/debug.png", t_bitmap); + asset->add("/data/nokia.txt", t_font); + asset->add("/data/nokia.png", t_bitmap); asset->add("/data/z80.png", t_bitmap); asset->add("/data/notify.png", t_bitmap); asset->add("/data/notify.wav", t_sound); @@ -243,7 +245,7 @@ void initText() // Inicializa el teclado en pantalla void initOnScreenKeyboard() { - osk = new OnScreenKeyboard(renderer, input, asset->get("smb2.png"), asset->get("smb2.txt"), options, options->screen.nativeWidth - 30, options->screen.nativeHeight - 80, "JailDesigner"); + osk = new OnScreenKeyboard(renderer, input, asset->get("nokia.png"), asset->get("nokia.txt"), options, options->screen.nativeWidth - 30, options->screen.nativeHeight - 80, "JailDesigner"); osk->setBgColor({123, 99, 63}); osk->setCaption("JAILER_ID"); osk->setChars(USE_UPPER | USE_LOWER | USE_NUMBER); diff --git a/units/on_screen_keyboard.cpp b/units/on_screen_keyboard.cpp index 6d1c2c4..789a0d0 100644 --- a/units/on_screen_keyboard.cpp +++ b/units/on_screen_keyboard.cpp @@ -105,7 +105,8 @@ void OnScreenKeyboard::fillTexture() // SDL_SetRenderDrawColor(renderer, color.r, color.g, color.b, 255); // SDL_Rect rect = {offset_x + (layout.at(pos).col * dist), offset_y + (layout.at(pos).row * dist), dist, dist}; // SDL_RenderFillRect(renderer, &rect); - text->write(offset_x + (layout.at(pos).col * dist) + 4, offset_y + (layout.at(pos).row * dist) + 4, layout.at(pos).caption); + // text->write(offset_x + (layout.at(pos).col * dist) + (dist / 2), offset_y + (layout.at(pos).row * dist) + (dist / 2), layout.at(pos).caption); + text->writeCentered(offset_x + (layout.at(pos).col * dist) + (dist / 2), offset_y + (layout.at(pos).row * dist) + (dist / 4), layout.at(pos).caption); } } @@ -261,6 +262,10 @@ void OnScreenKeyboard::render() { SDL_RenderCopy(renderer, texture, nullptr, &dest); SDL_RenderCopy(renderer, textureCursor, nullptr, &cursor.dest); + + const int pos = cursor.col + cursor.row * columns; + const string key = pos < layout.size() ? layout.at(pos).caption : ""; + text->writeDX(TXT_CENTER | TXT_COLOR, cursor.dest.x + cursor.dest.w / 2, cursor.dest.y + cursor.dest.w / 4, key, 1, {0, 255, 0}); text->write(dest.x + outputDest.x, dest.y + outputDest.y, output); }