2023-07-05 08:37:27 +00:00
|
|
|
#ifndef __UI
|
|
|
|
#define __UI
|
2023-07-03 15:40:28 +00:00
|
|
|
#include "vec.h"
|
|
|
|
|
2023-07-05 08:37:27 +00:00
|
|
|
typedef struct _ui_position {
|
|
|
|
vec3 relative;
|
|
|
|
vec3 absolute;
|
|
|
|
} ui_pos;
|
|
|
|
|
2023-07-03 15:40:28 +00:00
|
|
|
typedef struct _ui_button {
|
2023-07-05 08:37:27 +00:00
|
|
|
ui_pos position;
|
|
|
|
/* x,y - width,height, z - unused */
|
2023-07-03 15:40:28 +00:00
|
|
|
vec3 size; // size in pixels - if screen is too small i am not sure if it is a smart idea to make everything smaller
|
2023-07-05 09:24:14 +00:00
|
|
|
void (*onClick)(); // instead of passing stuff in, im just gonna put every state variable in global scope to ensure everything lives...
|
2023-07-05 08:37:27 +00:00
|
|
|
char* text;
|
2023-07-06 08:24:46 +00:00
|
|
|
char clicked;
|
2023-07-03 15:40:28 +00:00
|
|
|
} ui_button;
|
|
|
|
|
2023-07-05 08:37:27 +00:00
|
|
|
typedef struct _ui_slider {
|
|
|
|
ui_pos position;
|
|
|
|
/* x - width, y - height, z - middle circle radius */
|
|
|
|
vec3 size;
|
|
|
|
float value; // Value will always range between 0 and 1
|
|
|
|
} ui_slider;
|
|
|
|
|
|
|
|
void ui_button_draw(ui_button* b);
|
2023-07-05 09:24:14 +00:00
|
|
|
char ui_button_mouse_over(ui_button* b, int mouseX, int mouseY);
|
2023-07-05 08:37:27 +00:00
|
|
|
|
|
|
|
void ui_slider_draw(ui_slider* s);
|
2023-07-05 09:24:14 +00:00
|
|
|
char ui_slider_mouse_over(ui_slider* s, int mouseX, int mouseY);
|
2023-07-06 08:24:46 +00:00
|
|
|
void ui_slider_onclick(ui_slider* s, int mouseX, int mouseY);
|
2023-07-05 08:37:27 +00:00
|
|
|
|
2023-07-03 15:40:28 +00:00
|
|
|
#endif
|