From: hgn Date: Sat, 10 Jun 2023 10:46:37 +0000 (+0100) Subject: modal X-Git-Url: https://harrygodden.com/git/?p=vg.git;a=commitdiff_plain;h=12e185e1d639a38f8a00a350c2fc096e6cdba5de modal --- diff --git a/vg_imgui.h b/vg_imgui.h index 1b5acea..1d6cbb1 100644 --- a/vg_imgui.h +++ b/vg_imgui.h @@ -82,10 +82,18 @@ typedef u32 ui_scheme[8*4]; #define UI_TEXTBOX_MULTILINE 0x1 #define UI_TEXTBOX_WRAP 0x2 #define UI_TEXTBOX_AUTOFOCUS 0x4 + +#define UI_MODAL_OK 0x1 +#define UI_MODAL_YES 0x2 +#define UI_MODAL_NO 0x4 +#define UI_MODAL_CANCEL 0x8 + #define UI_MOUSE_LEFT (SDL_BUTTON(SDL_BUTTON_LEFT)) #define UI_MOUSE_RIGHT (SDL_BUTTON(SDL_BUTTON_RIGHT)) #define UI_MOUSE_MIDDLE (SDL_BUTTON(SDL_BUTTON_MIDDLE)) + + struct{ struct ui_vert *vertex_buffer; u16 *indice_buffer; @@ -107,7 +115,8 @@ struct{ enum ui_control_type{ k_ui_control_none, k_ui_control_textbox, - k_ui_control_dropdown + k_ui_control_dropdown, + k_ui_control_modal } focused_control_type; @@ -137,6 +146,16 @@ struct{ ui_rect rect; } dropdown; + + struct ui_modal{ + const char *message; + u32 options; + + struct ui_modal_callbacks{ + void (*close)(u32); + } + callbacks; + }; }; GLuint tex_glyphs, vao, vbo, ebo;