#include "zx_dialog_joystick.h" #include "ui.h" #include "z80debug.h" #include "gamepad.h" namespace dialogs { namespace joysticks { int32_t selected = 0; void init(int32_t index) { if (index != -1) selected = index; ui::setDialog(dialogs::joysticks::show); z80debug::pause(); } void show() { uint8_t back_color = COLOR_DARK; uint8_t front_color = COLOR_WHITE; ui::setoffset(0,0); ui::printrect(36, 15, 46, 12, COLOR_DARK); ui::panel(36,15,46,12,"CONFIGURE JOYSTICKS:"); if (ui::mouseInside(34,9,7,1)) { back_color = COLOR_WHITE; front_color = COLOR_BLACK; if (ui::getClicked()) { ui::setDialog(nullptr); z80debug::cont(); } } ui::printrect(34, 9, 7, 1, back_color); ui::printtxt(35,9,"CLOSE", front_color); ui::panel(38,17,20,8,"JOYSTICKS:"); const int num_gamepads = gamepad::getNumGamepads(); if (selected>=num_gamepads) selected = 0; for (int i=0; i