world_of_cow/ui.h

33 lines
No EOL
989 B
C

#ifndef __UI
#define __UI
#include "vec.h"
typedef struct _ui_position {
vec3 relative;
vec3 absolute;
} ui_pos;
typedef struct _ui_button {
ui_pos position;
/* x,y - width,height, z - unused */
vec3 size; // size in pixels - if screen is too small i am not sure if it is a smart idea to make everything smaller
void (*onClick)(); // instead of passing stuff in, im just gonna put every state variable in global scope to ensure everything lives...
char* text;
char clicked;
} ui_button;
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);
char ui_button_mouse_over(ui_button* b, int mouseX, int mouseY);
void ui_slider_draw(ui_slider* s);
char ui_slider_mouse_over(ui_slider* s, int mouseX, int mouseY);
void ui_slider_onclick(ui_slider* s, int mouseX, int mouseY);
#endif