From 154436ab88925540f86f43c0ac885c080949aa9b Mon Sep 17 00:00:00 2001 From: Jonathan Bradley Date: Tue, 19 Aug 2025 13:51:40 -0400 Subject: pke: ui box type button image --- src/static-ui.hpp | 31 +++++++++++++++++++++---------- 1 file changed, 21 insertions(+), 10 deletions(-) (limited to 'src/static-ui.hpp') 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 &buffer, pke_ui_flex_params *flex_params, pke_ui_box *box); -void pke_ui_recalc_sizes_recursive(pk_arr_t &arr, pke_ui_box *box); +void pke_ui_calc_px(pk_arr_t &buffer, pk_arr_t> &tmp_txtr_buffer, pke_ui_flex_params *flex_params, pke_ui_box *box); +void pke_ui_recalc_sizes_recursive(pk_arr_t &arr, pk_arr_t> &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 */ -- cgit v1.2.3