Mercurial > molko
view 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 |
line wrap: on
line source
/* * ui.h -- libui convenient header * * Copyright (c) 2020-2023 David Demelier <markand@malikania.fr> * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ #ifndef MLK_UI_UI_H #define MLK_UI_UI_H #include <mlk/core/core.h> MLK_CORE_BEGIN_DECLS /* TODO: make this a global variable to allow modification of default theme. */ /* https://lospec.com/palette-list/duel */ #define MLK_UI_COLOR_TEXT 0x222323ff #define MLK_UI_COLOR_SELECTED 0x55b67dff #define MLK_UI_COLOR_BG 0xf5f7faff #define MLK_UI_COLOR_BORDER 0xcdd2daff #define MLK_UI_COLOR_DEBUG 0xe45c5fff enum mlk_align; struct mlk_font; enum mlk_ui_font { MLK_UI_FONT_INTERFACE, MLK_UI_FONT_LAST }; extern struct mlk_font *mlk_ui_fonts[MLK_UI_FONT_LAST]; int mlk_ui_init(void); /* TODO: probably better somewhere else? */ void mlk_ui_draw_text(enum mlk_align align, struct mlk_font *font, unsigned long color, const char *text, int x, int y, unsigned int w, unsigned int h); void mlk_ui_finish(void); MLK_CORE_END_DECLS #endif /* !MLK_UI_UI_H */