#include "jui.h" #include "jdraw.h" #include "jinput.h" #include #include namespace ui { 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) { strcpy(temp, label); const int size = strlen(label); temp[size] = key+19; temp[size+1] = '\0'; return temp; } const int wheel = input::mouseWheel(); if (wheel != 0) { const int value = SDL_atoi(label)+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