summaryrefslogtreecommitdiff
path: root/prge_gui.c
diff options
context:
space:
mode:
Diffstat (limited to 'prge_gui.c')
-rw-r--r--prge_gui.c60
1 files changed, 0 insertions, 60 deletions
diff --git a/prge_gui.c b/prge_gui.c
deleted file mode 100644
index b4be331..0000000
--- a/prge_gui.c
+++ /dev/null
@@ -1,60 +0,0 @@
-B32 inrect(V2 pos, V2 start, V2 end)
-{
- B32 res;
- res = ((pos.x > start.x) && (pos.x < end.x) &&
- (pos.y > start.y) && (pos.y < end.y));
- return res;
-}
-
-void beginui(Shader shader, PRGEWindow wnd)
-{
- MAT4 proj;
-
- glUseProgram(shader.id);
- proj = ortho(0.0f, (F32)wnd.w, 0.0f, (F32)wnd.h, -1.0f, 1.0f);
- setmat4fv(shader.id, PRGE_SHADER_PROJ_MAT, proj);
- glDisable(GL_DEPTH_TEST);
-}
-
-void endui(void)
-{
- glEnable(GL_DEPTH_TEST);
- glUseProgram(0);
-}
-
-B32 button(PRGEContext *prgectx, Shader shader, const char *name, V2 center, F32 w, F32 h)
-{
- B32 pressed;
- Mesh quad;
- V2 start, end;
-
- MAT4 model;
- V4 color;
-
- pressed = 0;
-
- quad = gen_quad(prgectx->tmpa, v3fromv2(center), V3_ZERO, w, h);
-
- color = v4(1.0f, 0.0f, 0.0f, 1.0f);
- start = v2(center.x-w/2.0f, center.y-h/2.0f);
- end = v2(center.x+w/2.0f, center.y+h/2.0f);
-
- if (inrect(prgectx->in.mouse_pos, start, end) && !prgectx->in.capture_mouse) {
- color = v4(0.0f, 0.0f, 1.0f, 1.0f);
- if (is_key_pressed(prgectx->in.mouse_left)) {
- sys_printf("%s\n", name);
- pressed = 1;
- }
- }
-
- model = translmat4(MAT4_IDENTITY, v3(center.x, prgectx->wnd.h-center.y, 0.0f));
-
- setmat4fv(shader.id, "model", model);
- set4fv(shader.id, "color", color);
-
- draw_mesh(quad);
-
- clear_mesh(&quad);
-
- return pressed;
-}