From afa59cdb5a3290a9b943b31134919c2122a51f7b Mon Sep 17 00:00:00 2001 From: Raimon Zamora Date: Sat, 16 Aug 2025 18:22:02 +0200 Subject: [PATCH] - [FIX] [zx_dialog_joystick] No es podia seleccionar quin joystick configurar - [FIX] al recrear una finestra de vegades es perdia la textura de les fonts de la UI. --- ui.cpp | 1 - zx_dialog_joystick.cpp | 18 +++++++++++++----- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/ui.cpp b/ui.cpp index 06044ae..a81c377 100644 --- a/ui.cpp +++ b/ui.cpp @@ -41,7 +41,6 @@ namespace ui void setrenderer(SDL_Renderer *renderer, SDL_Texture *texture) { - if (ren==renderer) return; ren = renderer; tex = texture; offset_x = offset_y = 0; diff --git a/zx_dialog_joystick.cpp b/zx_dialog_joystick.cpp index a17bda4..fc7743e 100644 --- a/zx_dialog_joystick.cpp +++ b/zx_dialog_joystick.cpp @@ -40,12 +40,20 @@ namespace dialogs { char name[] = "JOYSTICK 0"; name[9] = 48+i; - if (selected==i) { - ui::printrect(0,i,18,1, COLOR_WHITE); - ui::printtxt(0,i,name, COLOR_BLACK); - } else { - ui::printtxt(0,i,name, COLOR_WHITE); + back_color = COLOR_DARK; + front_color = COLOR_WHITE; + if (ui::mouseInside(0,i,18,1)) { + back_color = COLOR_BLACK; + if (ui::getClicked()) { + selected = i; + } } + if (selected==i) { + back_color = COLOR_WHITE; + front_color = COLOR_BLACK; + } + ui::printrect(0,i,18,1, back_color); + ui::printtxt(0,i,name, front_color); } ui::panel(60,17,20,8,"TYPE:"); const int selected_type = gamepad::getGamepadType(selected);