diff options
| author | Jonathan Bradley <jcb@pikum.xyz> | 2025-04-21 15:46:46 -0400 |
|---|---|---|
| committer | Jonathan Bradley <jcb@pikum.xyz> | 2025-04-21 15:46:46 -0400 |
| commit | ef37d054dfe5812efa9eefb4b9b18621fdabac25 (patch) | |
| tree | 713042c875004da0058bf5813c4b2b736b6c4ed3 /src/static-ui.cpp | |
| parent | a066448effaa9a56c049136067a73ba0156f65d3 (diff) | |
pke: first-pass serializing ui and font renders
Diffstat (limited to 'src/static-ui.cpp')
| -rw-r--r-- | src/static-ui.cpp | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/static-ui.cpp b/src/static-ui.cpp index 9df7ffa..823c015 100644 --- a/src/static-ui.cpp +++ b/src/static-ui.cpp @@ -2,6 +2,7 @@ #include "static-ui.hpp" #include "dynamic-array.hpp" +#include "ecs.hpp" #include "game-settings.hpp" #include "pk.h" #include "static-plane.hpp" @@ -458,7 +459,7 @@ void pke_ui_internal_new_typed_box(pke_ui_box *box, const PKE_UI_BOX_TYPE type) } } -pke_ui_box *pke_ui_box_new_root(const PKE_UI_BOX_TYPE type) { +pke_ui_box *pke_ui_box_new_root(const PKE_UI_BOX_TYPE type, pk_uuid uuid) { if (pke_ui_master.h_root_boxes == pke_ui_master.r_root_boxes) { pke_ui_box_count_T prev_r_root_boxes = pke_ui_master.r_root_boxes; pke_ui_master.r_root_boxes *= 1.5; @@ -470,16 +471,18 @@ pke_ui_box *pke_ui_box_new_root(const PKE_UI_BOX_TYPE type) { pke_ui_master.root_boxes = boxes; } pke_ui_box *box = pk_new<pke_ui_box>(pke_ui_master.bkt); - memset(box, 0, sizeof(pke_ui_box)); + *box = {}; pke_ui_master.root_boxes[pke_ui_master.h_root_boxes] = box; pke_ui_master.h_root_boxes += 1; pke_ui_master.should_recalc_ui = true; box->type = type; pke_ui_internal_new_typed_box(box, type); + box->uuid = uuid; + ECS_CreateEntity(box, nullptr); return box; } -pke_ui_box *pke_ui_box_new_child(pke_ui_box *parent, const PKE_UI_BOX_TYPE type) { +pke_ui_box *pke_ui_box_new_child(pke_ui_box *parent, const PKE_UI_BOX_TYPE type, pk_uuid uuid) { assert(parent != nullptr); // validation @@ -502,13 +505,15 @@ pke_ui_box *pke_ui_box_new_child(pke_ui_box *parent, const PKE_UI_BOX_TYPE type) parent->internal.children = boxes; } pke_ui_box *box = pk_new<pke_ui_box>(pke_ui_master.bkt); - memset(box, 0, sizeof(pke_ui_box)); + *box = {}; parent->internal.children[parent->internal.h_children] = box; parent->internal.h_children += 1; box->type = type; box->internal.parent = parent; pke_ui_master.should_recalc_ui = true; pke_ui_internal_new_typed_box(box, type); + box->uuid = uuid; + ECS_CreateEntity(box, parent); return box; } |
