diff options
| author | Jonathan Bradley <jcb@pikum.xyz> | 2025-03-12 17:26:48 -0400 |
|---|---|---|
| committer | Jonathan Bradley <jcb@pikum.xyz> | 2025-03-12 17:26:48 -0400 |
| commit | 85a2ba407b1ae285b4080e14f8a18ecf4ec7da2c (patch) | |
| tree | 0abe7044b6af5820e9f3c143733047b254e78e15 /src/static-ui.hpp | |
| parent | 68ef51ed3247dc4e7bd5970b9279a7d6a938ca52 (diff) | |
pke: more testing features + more ui flex work
Diffstat (limited to 'src/static-ui.hpp')
| -rw-r--r-- | src/static-ui.hpp | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/src/static-ui.hpp b/src/static-ui.hpp index 0cc7aa2..a9b751b 100644 --- a/src/static-ui.hpp +++ b/src/static-ui.hpp @@ -4,6 +4,8 @@ #include "components-vk.hpp" #include <cstdint> +#define built_in_offset 2.0 + struct MSDFGlyphSettings { float width; float height; @@ -14,22 +16,18 @@ struct MSDFGlyphSettings { enum PKE_UI_BOX_FLAGS : uint64_t { PKE_UI_BOX_FLAG_NONE = 0, - // position type [0-1] + // position type [0-4] // exact screen coordinates PKE_UI_BOX_FLAG_POSITION_TYPE_FLEX = (1 << 0), PKE_UI_BOX_FLAG_POSITION_TYPE_STATIC = (1 << 1), PKE_UI_BOX_FLAG_POSITION_TYPE_DYNAMIC = (1 << 2), PKE_UI_BOX_FLAG_POSITION_TYPE_ALL = (1 << 0) | (1 << 1) | (1 << 2), - /* - // grow [2-3] - PKE_UI_BOX_FLAG_GROW_HORIZONTAL = (1 << 3), - PKE_UI_BOX_FLAG_GROW_VERTICAL = (1 << 4), - PKE_UI_BOX_FLAG_GROW_BOTH = (1 << 3) | (1 << 4), - */ - // center [4-5] + // center [5-6] PKE_UI_BOX_FLAG_CENTER_HORIZONTAL = (1 << 5), PKE_UI_BOX_FLAG_CENTER_VERTICAL = (1 << 6), PKE_UI_BOX_FLAG_CENTER_BOTH = (1 << 5) | (1 << 6), + // visibility [7-9] + PKE_UI_BOX_FLAG_VISIBILITY_INVISIBLE = (1 << 7), }; typedef uint16_t pke_ui_box_count_T; @@ -41,6 +39,8 @@ struct pke_ui_box { float pos_top_left_x, pos_top_left_y; float min_width, min_height; float max_width, max_height; + float flex_weight; + uint8_t flex_direction; uint8_t layer; struct pke_ui_box_internals { float px_corner_x, px_corner_y; @@ -73,6 +73,11 @@ void pke_ui_teardown(); pke_ui_box *pke_ui_box_new_root(); pke_ui_box *pke_ui_box_new_child(pke_ui_box *parent); +#ifdef PKE_TEST_EXPOSE +void pke_ui_calc_px(DynArray<pke_ui_box_instance_buffer_item> &buffer, pke_ui_flex_params *flex_params, pke_ui_box *box); +void pke_ui_recalc_sizes_recursive(DynArray<pke_ui_box_instance_buffer_item> &arr, pke_ui_box *box, uint8_t depth = 0); +#endif + pke_ui_graphics_bindings *pke_ui_get_graphics_bindings(); #endif /* PKE_STATIC_UI_HPP */ |
