diff options
Diffstat (limited to 'include/mgui')
-rw-r--r-- | include/mgui/image.h | 5 | ||||
-rw-r--r-- | include/mgui/list.h | 2 | ||||
-rw-r--r-- | include/mgui/mgui.h | 4 | ||||
-rw-r--r-- | include/mgui/richtext.h | 1 | ||||
-rw-r--r-- | include/mgui/widget.h | 9 |
5 files changed, 17 insertions, 4 deletions
diff --git a/include/mgui/image.h b/include/mgui/image.h index e6787f2..d9ed025 100644 --- a/include/mgui/image.h +++ b/include/mgui/image.h @@ -4,11 +4,16 @@ #include "widget.h" #include <mgl/graphics/sprite.h> +typedef struct mgui_async_image mgui_async_image; + typedef struct { mgui_widget widget; mgl_sprite sprite; + mgui_async_image *async_image; + mgl_vec2i max_size; } mgui_image; +/* If |filepath| is not a valid image then the image will be a broken-icon type */ mgui_image* mgui_image_create(const char *filepath); void mgui_image_destroy(mgui_image *image); mgui_widget* mgui_image_to_widget(mgui_image *list); diff --git a/include/mgui/list.h b/include/mgui/list.h index 7769ab6..92dce0a 100644 --- a/include/mgui/list.h +++ b/include/mgui/list.h @@ -21,6 +21,7 @@ typedef struct { typedef struct { mgui_widget widget; mgui_list_direction direction; + int spacing; mgl_vec2i position; mgui_list_item *items; size_t items_capacity; @@ -32,6 +33,7 @@ void mgui_list_destroy(mgui_list *list); mgui_widget* mgui_list_to_widget(mgui_list *list); mgui_list* mgui_widget_to_list(mgui_widget *widget); +void mgui_list_set_spacing(mgui_list *self, int spacing); void mgui_list_set_position(mgui_list *self, mgl_vec2i position); void mgui_list_calculate_size(mgui_list *self, mgl_vec2i max_size); void mgui_list_append(mgui_list *self, mgui_widget *widget); diff --git a/include/mgui/mgui.h b/include/mgui/mgui.h index 15a2f73..cb018d5 100644 --- a/include/mgui/mgui.h +++ b/include/mgui/mgui.h @@ -6,9 +6,13 @@ typedef struct mgl_event mgl_event; typedef struct mgl_window mgl_window; void mgui_init(); +void mgui_deinit(); void mgui_on_event(mgui_widget *root_widget, mgl_window *window, mgl_event *event); +/* This should only be called once every frame */ void mgui_draw(mgui_widget *root_widget, mgl_window *window); /* Clamped to 1.0 second */ double mgui_get_seconds_since_last_update(); +/* Clamped to 1.0 second */ +double mgui_get_frame_time_seconds(); #endif /* MGUI_H */ diff --git a/include/mgui/richtext.h b/include/mgui/richtext.h index ff57271..f3b07a5 100644 --- a/include/mgui/richtext.h +++ b/include/mgui/richtext.h @@ -23,6 +23,7 @@ typedef struct { int width; mgui_richtext_vertex_data vertex_data[2]; bool dirty; + bool vertices_dirty; } mgui_richtext; mgui_richtext* mgui_richtext_create(const char *str, size_t size, unsigned char character_size); diff --git a/include/mgui/widget.h b/include/mgui/widget.h index d425c11..0e77fd2 100644 --- a/include/mgui/widget.h +++ b/include/mgui/widget.h @@ -40,10 +40,10 @@ typedef enum { } mgui_widget_flags; typedef struct { - int left; - int right; - int top; - int bottom; + uint16_t left; + uint16_t right; + uint16_t top; + uint16_t bottom; } mgui_margin; struct mgui_widget { @@ -52,6 +52,7 @@ struct mgui_widget { uint8_t alignment; /* mgui_alignment, MGUI_WIDGET_ALIGN_TOP_LEFT by default */ mgui_margin margin; mgl_vec2i size; + void *userdata; }; void mgui_widget_init(mgui_widget *self, mgui_widget_type type); |