summaryrefslogtreecommitdiff
path: root/src/static-ui.hpp
diff options
context:
space:
mode:
authorJonathan Bradley <jcb@pikum.xyz>2025-03-13 18:31:27 -0400
committerJonathan Bradley <jcb@pikum.xyz>2025-03-13 18:31:27 -0400
commite17d9402663859f7fd1d83bdc5e6b7bf0489974e (patch)
tree074abaf544e4f8ea7dbd53afcd4a1105d4e48546 /src/static-ui.hpp
parenta88391495ac5008e84e379c50d04381ffe1363cd (diff)
pke: refactor for tracking padding via lbrt
Diffstat (limited to 'src/static-ui.hpp')
-rw-r--r--src/static-ui.hpp19
1 files changed, 13 insertions, 6 deletions
diff --git a/src/static-ui.hpp b/src/static-ui.hpp
index a9b751b..6586a02 100644
--- a/src/static-ui.hpp
+++ b/src/static-ui.hpp
@@ -2,6 +2,8 @@
#define PKE_STATIC_UI_HPP
#include "components-vk.hpp"
+#include "vendor-glm-include.hpp"
+
#include <cstdint>
#define built_in_offset 2.0
@@ -16,18 +18,19 @@ struct MSDFGlyphSettings {
enum PKE_UI_BOX_FLAGS : uint64_t {
PKE_UI_BOX_FLAG_NONE = 0,
- // position type [0-4]
+ // [00-04] position type
// 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),
- // center [5-6]
+ // [05-06] center
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]
+ // [07-09] visibility
PKE_UI_BOX_FLAG_VISIBILITY_INVISIBLE = (1 << 7),
+ // [10-??]
};
typedef uint16_t pke_ui_box_count_T;
@@ -43,9 +46,13 @@ struct pke_ui_box {
uint8_t flex_direction;
uint8_t layer;
struct pke_ui_box_internals {
- float px_corner_x, px_corner_y;
- float px_width, px_height;
- float px_offset_x, px_offset_y;
+ // the exact px to translate (shader)
+ glm::vec2 px_corner;
+ // the exact px for scaling (shader)
+ glm::vec2 px_size;
+ // internal padding + running offset for adding children
+ // glm::vec4 px_padding;
+ float px_padding_l, px_padding_b, px_padding_r, px_padding_t;
pke_ui_box *parent;
pke_ui_box **children;
pke_ui_box_count_T h_children;