#include "ui_menu.h" #include "ui.h" #include #include #include "zx_screen.h" namespace ui { namespace menu { #define OPTION_TYPE_NORMAL 0 #define OPTION_TYPE_SEPARATOR 1 #define OPTION_TYPE_BOOLEAN 2 struct option_t { std::string label; int type; int value; int (*callback)(int); }; struct menu_t { std::string label; SDL_Rect rect; std::vector options; }; void(*exit_callback)(void) = nullptr; std::vector menus; int visible_menu = -1; int menu_x = 0; void init() { // No se si hi ha algo que fer acĂ­... } void show() { int mx, my; Uint32 mb = SDL_GetMouseState(&mx, &my); mx=mx/CHR_W; my=my/CHR_H; int w; ui::printrect(0, 0, 320, 1, COLOR_BLACK); int opt_pos=1; int index=0; for (auto &menu : menus) { const int text_size = (menu.label.size()+2); uint8_t text_color = COLOR_WHITE; if (my<1 && mx>=opt_pos && mx=menu_x && mx