diff --git a/source/jui.cpp b/source/jui.cpp index 87872e9..f47cb1c 100644 --- a/source/jui.cpp +++ b/source/jui.cpp @@ -5,11 +5,11 @@ namespace ui { - const bool button(const char *label, const int x, const int y, const int w, const int h) + const int button(const char *label, const int x, const int y, const int w, const int h) { const int mx = input::mouseX(); const int my = input::mouseY(); - const bool btnDown = input::mouseBtn(1); + const bool btnDown = input::mouseBtn(1) || input::mouseBtn(3); const bool inside = (mx>=x) && (mx=y) && (my3)room_w=0; - restart(); - } - - draw::print("ROOM HEIGHT:", 330, 28, 15, 0); - if (ui::button(SDL_itoa(room_h, buffer, 10), 380, 25, 28, 11)) - { - room_h++;if(room_h>3)room_h=0; - restart(); - } + btn("ROOM WIDTH:", 330, 10, room_w, 0, 3); + btn("ROOM HEIGHT:", 330, 25, room_h, 0, 3); - draw::print("DOOR XP:", 330, 53, 15, 0); - if (ui::button(SDL_itoa(room_xp, buffer, 10), 380, 50, 28, 11)) - { - room_xp++;if(room_xp>5)room_xp=-1; - restart(); - } - draw::print("DOOR XN:", 330, 68, 15, 0); - if (ui::button(SDL_itoa(room_xn, buffer, 10), 380, 65, 28, 11)) - { - room_xn++;if(room_xn>5)room_xn=-1; - restart(); - } - draw::print("DOOR YP:", 330, 83, 15, 0); - if (ui::button(SDL_itoa(room_yp, buffer, 10), 380, 80, 28, 11)) - { - room_yp++;if(room_yp>5)room_yp=-1; - restart(); - } - draw::print("DOOR YN:", 330, 98, 15, 0); - if (ui::button(SDL_itoa(room_yn, buffer, 10), 380, 95, 28, 11)) - { - room_yn++;if(room_yn>5)room_yn=-1; - restart(); - } + btn("DOOR XP:", 330, 50, room_xp, -1, 5); + btn("DOOR XN:", 330, 65, room_xn, -1, 5); + btn("DOOR YP:", 330, 80, room_yp, -1, 5); + btn("DOOR YN:", 330, 95, room_yn, -1, 5); draw::render();