summaryrefslogtreecommitdiff
path: root/src/static-ui.hpp
diff options
context:
space:
mode:
authorJonathan Bradley <jcb@pikum.xyz>2025-02-28 22:33:58 -0500
committerJonathan Bradley <jcb@pikum.xyz>2025-02-28 22:33:58 -0500
commit37347bf7811a5fa42c98e2a19adfee15252ee479 (patch)
tree70fe178ad777f52404f51b90c06b8d14ef101276 /src/static-ui.hpp
parent85bbecbdebf4f096418aea1cd4f9616f9d97e451 (diff)
pke: checkpoint: vk renames + first-pass ui
Renamed pipeline and descriptor names to be more self-descriptive. UI work is not done, and will not record. Needs vulkan items created (buffers).
Diffstat (limited to 'src/static-ui.hpp')
-rw-r--r--src/static-ui.hpp62
1 files changed, 62 insertions, 0 deletions
diff --git a/src/static-ui.hpp b/src/static-ui.hpp
index b0bf98c..185b218 100644
--- a/src/static-ui.hpp
+++ b/src/static-ui.hpp
@@ -1,6 +1,9 @@
#ifndef PKE_STATIC_UI_HPP
#define PKE_STATIC_UI_HPP
+#include "components-vk.hpp"
+#include <cstdint>
+
struct MSDFGlyphSettings {
float width;
float height;
@@ -9,4 +12,63 @@ struct MSDFGlyphSettings {
float range_em;
};
+enum PKE_UI_BOX_FLAGS : uint64_t {
+ PKE_UI_BOX_FLAG_NONE = 0,
+ // position type [0-1]
+ // exact screen coordinates
+ PKE_UI_BOX_FLAG_POSITION_TYPE_STATIC = (1 << 0),
+ PKE_UI_BOX_FLAG_POSITION_TYPE_DYNAMIC = (1 << 1),
+ PKE_UI_BOX_FLAG_POSITION_TYPE_BOTH = (1 << 0) | (1 << 1),
+ // grow [2-3]
+ PKE_UI_BOX_FLAG_GROW_HORIZONTAL = (1 << 2),
+ PKE_UI_BOX_FLAG_GROW_VERTICAL = (1 << 3),
+ PKE_UI_BOX_FLAG_GROW_BOTH = (1 << 2) | (1 << 3),
+ // center [4-5]
+ PKE_UI_BOX_FLAG_CENTER_HORIZONTAL = (1 << 4),
+ PKE_UI_BOX_FLAG_CENTER_VERTICAL = (1 << 5),
+ PKE_UI_BOX_FLAG_CENTER_BOTH = (1 << 4) | (1 << 5),
+};
+
+typedef uint16_t pke_ui_box_count_T;
+
+struct pke_ui_box;
+
+struct pke_ui_box {
+ PKE_UI_BOX_FLAGS flags;
+ float pos_top_left_x, pos_top_left_y;
+ float max_width, max_height;
+ 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;
+ pke_ui_box *parent;
+ pke_ui_box **children;
+ pke_ui_box_count_T h_children;
+ pke_ui_box_count_T r_children;
+ } internal;
+};
+
+struct pke_ui_graphics_bindings {
+ VkDeviceMemory deviceMemoryVert = VK_NULL_HANDLE;
+ VkDeviceMemory deviceMemoryInst = VK_NULL_HANDLE;
+ BufferBindingDetails bd_vertex;
+ BufferBindingDetails bd_uv;
+ BufferBindingDetails bd_index;
+ BufferBindingDetails bd_instance;
+ uint32_t index_count;
+ uint32_t instance_counter;
+ uint32_t instance_buffer_max_count;
+};
+
+void pke_ui_init();
+void pke_ui_init_bindings();
+void pke_ui_tick(double delta);
+void pke_ui_teardown();
+
+pke_ui_box *pke_ui_box_new_root();
+pke_ui_box *pke_ui_box_new_child(pke_ui_box *parent);
+
+pke_ui_graphics_bindings *pke_ui_get_graphics_bindings();
+
#endif /* PKE_STATIC_UI_HPP */