preparing for buttons n menus
This commit is contained in:
parent
65c009e3af
commit
1859c47de2
BIN
obj/main.o
BIN
obj/main.o
Binary file not shown.
BIN
obj/menus.o
BIN
obj/menus.o
Binary file not shown.
|
@ -178,6 +178,7 @@ int main_alt() {
|
||||||
init_hashtbl();
|
init_hashtbl();
|
||||||
init_ent_generator(10);
|
init_ent_generator(10);
|
||||||
init_proj();
|
init_proj();
|
||||||
|
init_interf();
|
||||||
parse_rooms(6);
|
parse_rooms(6);
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------------------------------------------------------------------------- //
|
// ---------------------------------------------------------------------------------------------------------------------------------------------- //
|
||||||
|
@ -360,6 +361,7 @@ int main_alt() {
|
||||||
|
|
||||||
hashtbl_free(visited);
|
hashtbl_free(visited);
|
||||||
free_proj();
|
free_proj();
|
||||||
|
free_interf();
|
||||||
free_pool();
|
free_pool();
|
||||||
|
|
||||||
// optional: de-allocate all resources once they've outlived their purpose:
|
// optional: de-allocate all resources once they've outlived their purpose:
|
||||||
|
|
13
src/menus.c
13
src/menus.c
|
@ -132,3 +132,16 @@ void gl_drawInteger(unsigned int fragShader, int n, float x, float y, float size
|
||||||
void gl_initDrawRect(unsigned int shaderProgram) {
|
void gl_initDrawRect(unsigned int shaderProgram) {
|
||||||
glUseProgram(shaderProgram);
|
glUseProgram(shaderProgram);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static onoff_button* buttonList;
|
||||||
|
static interface* interfaceList;
|
||||||
|
|
||||||
|
void init_interf() {
|
||||||
|
buttonList = malloc(sizeof(onoff_button)*256);
|
||||||
|
interfaceList = malloc(sizeof(interface)*64);
|
||||||
|
}
|
||||||
|
|
||||||
|
void free_interf() {
|
||||||
|
free(buttonList);
|
||||||
|
free(interfaceList);
|
||||||
|
}
|
30
src/menus.h
30
src/menus.h
|
@ -1,6 +1,33 @@
|
||||||
#ifndef MENUS_H
|
#ifndef MENUS_H
|
||||||
#define MENUS_H
|
#define MENUS_H
|
||||||
|
|
||||||
|
typedef enum button_action {WARP, SET_VAR} button_action ;
|
||||||
|
|
||||||
|
typedef struct onoff_button {
|
||||||
|
int id;
|
||||||
|
|
||||||
|
char* text;
|
||||||
|
double x; double y; double w; double h;
|
||||||
|
int red;
|
||||||
|
int green;
|
||||||
|
int blue;
|
||||||
|
|
||||||
|
// {WARP, SET_VAR}
|
||||||
|
button_action type;
|
||||||
|
|
||||||
|
// the value to change (if SET_VAR) or the destination interface (if WARP)
|
||||||
|
int* metadata;
|
||||||
|
} onoff_button;
|
||||||
|
|
||||||
|
typedef struct interface {
|
||||||
|
int intfid;
|
||||||
|
|
||||||
|
char* title;
|
||||||
|
|
||||||
|
onoff_button* buttons;
|
||||||
|
int nbuttons;
|
||||||
|
} interface;
|
||||||
|
|
||||||
void initMenus();
|
void initMenus();
|
||||||
|
|
||||||
void gl_drawRect(unsigned int fragShader, float x, float y, float w, float h, int r, int g, int b);
|
void gl_drawRect(unsigned int fragShader, float x, float y, float w, float h, int r, int g, int b);
|
||||||
|
@ -8,4 +35,7 @@ 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_drawInteger(unsigned int fragShader, int n, float x, float y, float size, int r, int g, int b, float width, int side);
|
||||||
|
|
||||||
|
void init_interf();
|
||||||
|
void free_interf();
|
||||||
|
|
||||||
#endif
|
#endif
|
Loading…
Reference in New Issue