Add different return states for ui_noodle

This commit is contained in:
2024-02-25 20:52:25 +00:00
parent 373e48216d
commit a68d6997a5
2 changed files with 19 additions and 11 deletions

View File

@@ -21,6 +21,8 @@
typedef enum ui_elem_type ui_elem_type;
typedef struct ui_elem ui_elem;
typedef struct ui_ctx ui_ctx;
typedef struct ui_elem_colours ui_elem_colours;
typedef enum noodle_action noodle_action;
enum ui_elem_type {
UI_ELEM_NODE,
@@ -39,12 +41,17 @@ struct ui_elem {
ui_elem_type type;
};
typedef struct ui_elem_colours ui_elem_colours;
struct ui_elem_colours {
colour fill;
colour border;
};
enum noodle_action {
NOODLE_ACTION_NONE,
NOODLE_ACTION_DRAGGING,
NOODLE_ACTION_RELEASED,
};
struct ui_ctx {
u64 count;
i64 hovered;
@@ -66,7 +73,7 @@ bool ui_button(const window *wnd, ui_ctx *ctx, rect rect,
ui_elem_colours colours);
bool ui_node(const window *wnd, ui_ctx *ctx, rect rect,
ui_elem_colours colours);
bool ui_noodle(const window *wnd, ui_ctx *ctx, line ln, ui_elem_colours colours,
rect parent_node);
noodle_action ui_noodle(const window *wnd, ui_ctx *ctx, line ln,
ui_elem_colours colours, rect parent_node);
#endif // !UI_H