Remove predefined colours and allow user to pass colour as param

This commit is contained in:
2024-01-20 22:17:13 +00:00
parent f45fb04dff
commit 10149fbdbf
2 changed files with 18 additions and 27 deletions

View File

@@ -31,6 +31,12 @@ struct ui_elem {
ui_elem_type_t type;
};
typedef struct ui_elem_colours ui_elem_colours_t;
struct ui_elem_colours {
colour_t fill;
colour_t border;
};
struct ui_ctx {
u64 count;
i64 hovered;
@@ -49,7 +55,9 @@ void init_ui_ctx(ui_ctx_t *ctx);
void reset_ui_ctx(ui_ctx_t *ctx);
void handle_ui_events(const window_t *wnd, ui_ctx_t *ctx,
const SDL_Event *event);
bool button(const window_t *wnd, ui_ctx_t *ctx, rect_t rect);
rect_t node(const window_t *wnd, ui_ctx_t *ctx, rect_t rect);
bool button(const window_t *wnd, ui_ctx_t *ctx, rect_t rect,
ui_elem_colours_t colours);
rect_t node(const window_t *wnd, ui_ctx_t *ctx, rect_t rect,
ui_elem_colours_t colours);
#endif // !UI_H