type alias refactor

This commit is contained in:
2026-03-04 16:26:17 -05:00
parent 75ac2883f7
commit fb358e3c4b
19 changed files with 614 additions and 603 deletions

View File

@@ -19,51 +19,51 @@
struct UI_ModalState {
B32 active;
uint32_t id; // Hash of the modal's string ID
U32 id; // Hash of the modal's string ID
S32 result; // Button index pressed, -1 = pending
};
struct UI_WindowSlot {
uint32_t id; // Hash of the window's string ID (0 = unused)
U32 id; // Hash of the window's string ID (0 = unused)
Vec2F32 position;
Vec2F32 size;
B32 open;
int16_t z_order;
S16 z_order;
};
struct UI_KnobDragState {
uint32_t dragging_id; // Hash of the knob being dragged (0 = none)
U32 dragging_id; // Hash of the knob being dragged (0 = none)
F32 drag_start_y; // Mouse Y when drag started
F32 drag_start_x; // Mouse X when drag started (for h-slider)
F32 value_at_start; // Value when drag started
B32 was_shift; // Shift state last frame (to re-anchor on change)
uint32_t last_click_id; // Knob hash of last click (for double-click detection)
U32 last_click_id; // Knob hash of last click (for F64-click detection)
S32 last_click_frame; // Frame number of last click
};
struct UI_DragState {
uint32_t dragging_id; // Window ID currently being dragged (0 = none)
U32 dragging_id; // Window ID currently being dragged (0 = none)
Vec2F32 drag_anchor; // Mouse position when drag started
Vec2F32 pos_anchor; // Window position when drag started
};
struct UI_WidgetState {
// Text input focus
uint32_t focused_id; // Clay element ID hash of the focused text input (0 = none)
int32_t cursor_pos; // Cursor position in focused text input
U32 focused_id; // Clay element ID hash of the focused text input (0 = none)
S32 cursor_pos; // Cursor position in focused text input
F32 cursor_blink; // Blink timer (seconds)
// Text selection (sel_start == sel_end means no selection)
int32_t sel_start; // Selection anchor (where selection began)
int32_t sel_end; // Selection extent (moves with cursor)
S32 sel_start; // Selection anchor (where selection began)
S32 sel_end; // Selection extent (moves with cursor)
// Tab cycling: registered text input IDs in order of declaration
uint32_t text_input_ids[UI_WIDGET_MAX_TEXT_INPUTS];
int32_t text_input_count;
U32 text_input_ids[UI_WIDGET_MAX_TEXT_INPUTS];
S32 text_input_count;
B32 tab_pressed; // True on the frame Tab was pressed
// Dropdown
uint32_t open_dropdown_id; // Clay element ID hash of the open dropdown (0 = none)
U32 open_dropdown_id; // Clay element ID hash of the open dropdown (0 = none)
// Input for this frame
PlatformInput input;
@@ -77,14 +77,14 @@ struct UI_WidgetState {
// Window state
UI_WindowSlot windows[UI_WIDGET_MAX_WINDOWS];
S32 window_count;
int16_t next_z;
S16 next_z;
UI_DragState drag;
// Knob drag state
UI_KnobDragState knob_drag;
// Knob text edit state
uint32_t knob_edit_id; // Hash of knob in text edit mode (0 = none)
U32 knob_edit_id; // Hash of knob in text edit mode (0 = none)
char knob_edit_buf[32]; // Text buffer for numeric entry
S32 knob_edit_cursor; // Cursor position in edit buffer
S32 knob_edit_sel_start; // Selection anchor
@@ -154,7 +154,7 @@ B32 ui_window(const char *id, const char *title, B32 *open,
// Knob / potentiometer. Vertical drag to change value.
// unsigned (is_signed=0): value in [0, max_val]
// signed (is_signed=1): value in [-max_val, +max_val]
// default_val: value restored on double-click.
// default_val: value restored on F64-click.
// editable: if true, clicking the value text opens a text input for direct entry.
// Hold Shift while dragging for fine control.
// Returns true if value changed this frame.