diff options
| author | Jonathan Bradley <jcb@pikum.xyz> | 2025-09-25 12:09:10 -0400 |
|---|---|---|
| committer | Jonathan Bradley <jcb@pikum.xyz> | 2025-09-25 12:09:10 -0400 |
| commit | a503774a2413b6ab206eaeefd667287f0f80e2be (patch) | |
| tree | d92d12cd22f8a02eb99b60123b92350795007a31 | |
| parent | b84438b140c64b084919ea3366d4f4ff66e5b1c7 (diff) | |
pke: notes + ui box don't mark for removal twice.
| -rw-r--r-- | src/static-ui.cpp | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/src/static-ui.cpp b/src/static-ui.cpp index 517b4fd..752608e 100644 --- a/src/static-ui.cpp +++ b/src/static-ui.cpp @@ -16,6 +16,14 @@ #include <cstring> #include <vulkan/vulkan_core.h> +// 2025-09-25 TODO PERF +// Consider writing a generic recursive function for the boxes. +// It would make some of the work here easier to digest. +// Existing recursive functions *might* be too big. +// Some things (like checking for removing children) could be split out. +// However, this would likely have performance implications (maybe). +// I should come up with some concrete UI setups to test against. + const char *const ui_ux_mouse_left = "ui_ux_mouse_left"; const char *const ui_ux_mouse_right = "ui_ux_mouse_right"; const char *const ui_ux_mouse_middle = "ui_ux_mouse_middle"; @@ -89,7 +97,7 @@ void pke_ui_init() { new (&pke_ui_master.bindings_texture) texture_binding_bkt_arr{ pk_bkt_arr_handle_MAX_constexpr, pke_ui_master.bkt, MemBkt_Vulkan }; pke_input_set ui_controls_set{}; - ui_controls_set.title = "debug-editor-controls"; + ui_controls_set.title = "static ui"; ui_controls_set.actionCount = 3; ui_controls_set.actions = pk_new_arr<pke_input_action>(ui_controls_set.actionCount); ui_controls_set.flags = PKE_INPUT_ACTION_SET_FLAG_DO_NOT_SERIALIZE; @@ -715,7 +723,13 @@ void pke_ui_teardown_box_recursive(pke_ui_box *box, uint8_t depth) { box->type_data = nullptr; } pk_arr_append_t<pke_ui_box*>(&pke_ui_master.boxes_to_delete, box); - if (depth != 0) { + /* 2025-09-25 JCB HACK + * I'd like this to be more elegant, this seems hacky. + * We need to skip the first (the one we marked for removal). + * If we are manually managing child boxes (like deleting in the editor), + * then this can get called when depth > 0 but the box is already marked. + */ + if (depth != 0 && box->isMarkedForRemoval == false) { ECS_MarkForRemoval(box); } pke_ui_master.should_update_buffer = true; |
