#ifndef MGUI_RICHTEXT_H #define MGUI_RICHTEXT_H #include "widget.h" #include #include typedef struct mgl_vertex mgl_vertex; typedef struct { mgl_vertex *vertices; size_t vertices_capacity; size_t vertex_count; } mgui_richtext_vertex_data; typedef struct { mgui_widget widget; char *str; size_t str_size; unsigned int character_size; mgl_vec2i position; mgl_vec2i render_size; int width; mgui_richtext_vertex_data vertex_data[2]; /* size should match NUM_VERTEX_DATA */ /* TODO: Turn bools into flags */ bool dirty; bool vertices_dirty; } mgui_richtext; mgui_richtext* mgui_richtext_create(const char *str, size_t size, unsigned char character_size); void mgui_richtext_destroy(mgui_richtext *richtext); mgui_widget* mgui_richtext_to_widget(mgui_richtext *list); mgui_richtext* mgui_widget_to_richtext(mgui_widget *widget); void mgui_richtext_set_position(mgui_richtext *self, mgl_vec2i position); void mgui_richtext_calculate_size(mgui_richtext *self, mgl_vec2i max_size); void mgui_richtext_on_event(mgui_richtext *self, mgl_window *window, mgl_event *event); void mgui_richtext_draw(mgui_richtext *self, mgl_window *window); #endif /* MGUI_RICHTEXT_H */