summaryrefslogtreecommitdiff
path: root/src/static-ui.hpp
diff options
context:
space:
mode:
authorJonathan Bradley <jcb@pikum.xyz>2025-08-19 13:51:40 -0400
committerJonathan Bradley <jcb@pikum.xyz>2025-08-19 14:33:08 -0400
commit154436ab88925540f86f43c0ac885c080949aa9b (patch)
tree43a22f26286428f0d165fc1ff801cd0cb87092c6 /src/static-ui.hpp
parentebcae77b137a759c453b89a774ece5a755078a38 (diff)
pke: ui box type button image
Diffstat (limited to 'src/static-ui.hpp')
-rw-r--r--src/static-ui.hpp31
1 files changed, 21 insertions, 10 deletions
diff --git a/src/static-ui.hpp b/src/static-ui.hpp
index 3abfd26..eb26a45 100644
--- a/src/static-ui.hpp
+++ b/src/static-ui.hpp
@@ -146,13 +146,10 @@ union pke_ui_box_type_data {
pk_ev_id_T ev_id;
} button_text;
struct pke_ui_box_type_data_button_image {
- VkDeviceMemory image_memory;
- VkImage image_default;
- VkImageView image_view_default;
- VkImage image_hovered;
- VkImageView image_view_hovered;
- VkImage image_pressed;
- VkImageView image_view_pressed;
+ AssetKey img_key_default;
+ AssetKey img_key_hovered;
+ AssetKey img_key_pressed;
+ pk_bkt_arr_handle gr_binds_bkt_arr_handle;
PkeEventHandle pke_event_handle;
pk_ev_id_T ev_id;
} button_image;
@@ -170,6 +167,18 @@ struct pke_ui_graphics_bindings {
uint32_t instance_buffer_max_count;
};
+/* minimum amount of data needed to reuse the normal bindings but also bind textures
+ */
+struct pke_ui_graphics_bindings_texture {
+ uint32_t instance_offset;
+ uint32_t instance_count;
+ VkDescriptorSet *descriptor_sets;
+ VkDescriptorPool descriptor_pool;
+ VkDeviceMemory image_memory;
+ VkImage image;
+ VkImageView image_view;
+};
+
void pke_ui_init();
void pke_ui_init_bindings();
void pke_ui_tick(double delta);
@@ -180,12 +189,14 @@ pke_ui_box **pke_ui_get_root_boxes(pke_ui_box_count_T *count);
pke_ui_box *pke_ui_box_new_root(const PKE_UI_BOX_TYPE type = PKE_UI_BOX_TYPE_STANDARD, pk_uuid uuid = pk_uuid_zed);
pke_ui_box *pke_ui_box_new_child(pke_ui_box *parent, const PKE_UI_BOX_TYPE type = PKE_UI_BOX_TYPE_STANDARD, pk_uuid uuid = pk_uuid_zed);
+void pke_ui_box_update_textures(pke_ui_box *box);
#ifdef PKE_TEST_EXPOSE
-void pke_ui_calc_px(pk_arr_t<pke_ui_box_instance_buffer_item> &buffer, pke_ui_flex_params *flex_params, pke_ui_box *box);
-void pke_ui_recalc_sizes_recursive(pk_arr_t<pke_ui_box_instance_buffer_item> &arr, pke_ui_box *box);
+void pke_ui_calc_px(pk_arr_t<pke_ui_box_instance_buffer_item> &buffer, pk_arr_t<std::pair<pke_ui_box*,pke_ui_box_instance_buffer_item>> &tmp_txtr_buffer, pke_ui_flex_params *flex_params, pke_ui_box *box);
+void pke_ui_recalc_sizes_recursive(pk_arr_t<pke_ui_box_instance_buffer_item> &arr, pk_arr_t<std::pair<pke_ui_box*,pke_ui_box_instance_buffer_item>> &tmp_txtr_buffer, pke_ui_box *box);
#endif
-pke_ui_graphics_bindings *pke_ui_get_graphics_bindings();
+const pke_ui_graphics_bindings &pke_ui_get_graphics_bindings();
+void pke_ui_get_graphics_bindings_texture(pk_arr *arr);
#endif /* PKE_STATIC_UI_HPP */