#include "jui.h" #include "jdraw.h" #include "jinput.h" #include #include namespace ui { static int current_spin = -1; static int selected_spin = -1; static int hovering_spin = -1; void start() { current_spin = -1; } void label(const char *label, const int x, const int y, const int w, const int h, const int color) { draw::color(color); draw::fillrect(x, y, w, h); draw::color(WHITE); draw::rect(x, y, w, h); draw::print(label, x+3, y+3, BLACK, 0); } const bool button(const char *label, const int x, const int y, const int w, const int h, const bool pressed) { const int mx = draw::getLocalX(input::mouseX()); const int my = draw::getLocalY(input::mouseY()); const bool btnDown = input::mouseBtn(1) || input::mouseBtn(3); const bool inside = (mx>=x) && (mx=y) && (my=x) && (mx=y) && (my=x) && (mx=y) && (my=x) && (mx=y) && (my=SDL_SCANCODE_1 && key<=SDL_SCANCODE_9) || (key>=SDL_SCANCODE_KP_1 && key<=SDL_SCANCODE_KP_9) ) { selected_spin=current_spin; strcpy(temp, label); const int size = strlen(label); temp[size] = key<40 ? key+19 : key-40; temp[size+1] = '\0'; return temp; } const int wheel = input::mouseWheel(); if (wheel != 0) { selected_spin=current_spin; const int value = SDL_atoi(lbl)+wheel*(input::keyDown(SDL_SCANCODE_LCTRL)?32:1); SDL_itoa(value, temp, 10); return temp; } //if (input::mouseClk(1)) return 1; //if (input::mouseClk(3)) return 3; } return nullptr; } const int textbox(const char *label, const int x, const int y, const int w, const int h) { const int mx = draw::getLocalX(input::mouseX()); const int my = draw::getLocalY(input::mouseY()); const bool inside = (mx>=x) && (mx=y) && (my