#ifndef MENUS_H #define MENUS_H typedef enum button_action {NONE, WARP, SET_VAR, EXIT} button_action; typedef enum void_type {INT, FLOAT, DOUBLE} void_type; typedef struct onoff_button { int id; char* text; float x; float y; float w; float h; int red; int green; int blue; // {WARP, SET_VAR, EXIT} button_action type; // the value to change (if SET_VAR) or the destination interface (if WARP) void* metadata; void_type cast; // limits double inf; double sup; // is called upon clicking button // this function is executed before metadata is used void (*onClick)(void* args); void* arg; } onoff_button; typedef struct interface { int intfid; char* title; float x; float y; float w; float h; int red; int green; int blue; int* buttons; int nButtons; int nMemButtons; } interface; void initMenus(); void gl_drawRect(unsigned int fragShader, float x, float y, float w, float h, int r, int g, int b); void gl_drawRectAlpha(unsigned int fragShader, float x, float y, float w, float h, int r, int g, int b, int a); void gl_initDrawRect(unsigned int shaderProgram); void gl_drawInteger(unsigned int fragShader, int n, float x, float y, float size, int r, int g, int b, float width, int side); void gl_drawFloat(unsigned int fragShader, float n, float x, float y, float size, int r, int g, int b, float width, int side); void gl_drawChar(unsigned int fragShader, char ch, float x, float y, float size, int r, int g, int b, float width); void gl_drawSymbol(unsigned int fragShader, char ch, float x, float y, float size, int r, int g, int b, float width, float* retval); void gl_drawString(unsigned int fragShader, char* str, float x, float y, float size, int r, int g, int b, float width, int side); void gl_printf(unsigned int fragShader, float x, float y, float size, float width, int r, int g, int b, const char* str, ...); void init_interf(GLFWwindow *window); void reset_interf(); void free_interf(); bool isInMenu(GLFWwindow *win, unsigned int fragShader); bool isMenuOpen(); int button_create_onoff(char* text, int red, int green, int blue, float x, float y, float w, float h, button_action actn, void* val, double min, double max, void_type cast, void (*onClick)(void*), void* arg); int interface_create(char* title, int red, int green, int blue, float x, float y, float w, float h); void interface_link_button(int interface_id, int button_id); void interface_unlink_button(int interface_id, int button_id); void interface_set(int interface_id); void build_all_menus(); int build_text_box(char* msg, int red, int green, int blue); int build_lock_box(char* msg, int red, int green, int blue); #endif