]> git.lizzy.rs Git - dragonblocks_alpha.git/blobdiff - src/client/gui.h
refactoring
[dragonblocks_alpha.git] / src / client / gui.h
index 7fd1844820405dba9814f366cffcd5a3de541ed0..7f4c0d2479690ef11ee3fa9e88b188caff7f2639 100644 (file)
@@ -1,25 +1,22 @@
 #ifndef _GUI_H_
 #define _GUI_H_
 
-#include <stdbool.h>
+#include <dragonstd/array.h>
 #include <linmath.h/linmath.h>
-#include <dragonstd/bintree.h>
-#include <dragonstd/list.h>
+#include <stdbool.h>
 #include "client/font.h"
 #include "client/texture.h"
 #include "types.h"
 
-typedef enum
-{
-       GST_IMAGE,
-       GST_TEXT,
-       GST_PARENT,
-       GST_CHILDREN,
-       GST_NONE,
+typedef enum {
+       SCALE_IMAGE,
+       SCALE_TEXT,
+       SCALE_PARENT,
+       SCALE_CHILDREN,
+       SCALE_NONE,
 } GUIScaleType;
 
-typedef struct
-{
+typedef struct {
        v2f32 pos;
        f32 z_index;
        v2s32 offset;
@@ -34,8 +31,7 @@ typedef struct
        v4f32 bg_color;
 } GUIElementDefinition;
 
-typedef struct GUIElement
-{
+typedef struct GUIElement {
        GUIElementDefinition def;
        bool visible;
        v2f32 pos;
@@ -44,17 +40,15 @@ typedef struct GUIElement
        mat4x4 text_transform;
        Font *text;
        struct GUIElement *parent;
-       Bintree children;
+       Array children;
 } GUIElement;
 
 bool gui_init();
 void gui_deinit();
-void gui_on_resize(int width, int height);
+void gui_update_projection();
 void gui_render();
 GUIElement *gui_add(GUIElement *parent, GUIElementDefinition def);
-void gui_set_text(GUIElement *element, char *text);
-void gui_update_transform(GUIElement *element);
-
-extern GUIElement gui_root;
+void gui_text(GUIElement *element, char *text);
+void gui_transform(GUIElement *element);
 
-#endif
+#endif // _GUI_H_