comparison libmlk-ui/mlk/ui/ui.h @ 507:d49a05e7a5b5

ui: separate delegate/style Now UI elements do have different styling properties: - _delegate: functions used to update, draw or perform specific actions on the UI element. - _style: basic properties that the delegate should support if possible.
author David Demelier <markand@malikania.fr>
date Thu, 02 Mar 2023 21:36:43 +0100
parents 6100c643dba0
children 6e8f6640e05b
comparison
equal deleted inserted replaced
506:e205625015ba 507:d49a05e7a5b5
21 21
22 #include <mlk/core/core.h> 22 #include <mlk/core/core.h>
23 23
24 MLK_CORE_BEGIN_DECLS 24 MLK_CORE_BEGIN_DECLS
25 25
26 /* TODO: make this a global variable to allow modification of default theme. */
27 /* https://lospec.com/palette-list/duel */
28 #define MLK_UI_COLOR_TEXT 0x222323ff
29 #define MLK_UI_COLOR_SELECTED 0x55b67dff
30 #define MLK_UI_COLOR_BG 0xf5f7faff
31 #define MLK_UI_COLOR_BORDER 0xcdd2daff
32 #define MLK_UI_COLOR_DEBUG 0xe45c5fff
33
34 enum mlk_align;
35
26 struct mlk_font; 36 struct mlk_font;
27 37
28 enum mlk_ui_font { 38 enum mlk_ui_font {
29 MLK_UI_FONT_INTERFACE, 39 MLK_UI_FONT_INTERFACE,
30 MLK_UI_FONT_LAST 40 MLK_UI_FONT_LAST
33 extern struct mlk_font *mlk_ui_fonts[MLK_UI_FONT_LAST]; 43 extern struct mlk_font *mlk_ui_fonts[MLK_UI_FONT_LAST];
34 44
35 int 45 int
36 mlk_ui_init(void); 46 mlk_ui_init(void);
37 47
48 /* TODO: probably better somewhere else? */
49 void
50 mlk_ui_draw_text(enum mlk_align align,
51 struct mlk_font *font,
52 unsigned long color,
53 const char *text,
54 int x,
55 int y,
56 unsigned int w,
57 unsigned int h);
58
38 void 59 void
39 mlk_ui_finish(void); 60 mlk_ui_finish(void);
40 61
41 MLK_CORE_END_DECLS 62 MLK_CORE_END_DECLS
42 63