UI fixes
This commit is contained in:
27
ui/ui.jai
27
ui/ui.jai
@@ -480,6 +480,21 @@ ui_init :: () {
|
||||
|
||||
// # BEGIN # LAYOUT ALGORITHM
|
||||
ui_figure_out_sizes :: () {
|
||||
if ui_state.currently_moving_window {
|
||||
ui_state.currently_moving_window.offset.x += xx engine.input.mouse.delta_x;
|
||||
ui_state.currently_moving_window.offset.y += xx engine.input.mouse.delta_y;
|
||||
ui_state.currently_moving_window.offset.x -= xx min(0, ui_state.currently_moving_window.position.x + ui_state.currently_moving_window.offset.x);
|
||||
ui_state.currently_moving_window.offset.y -= xx min(0, ui_state.currently_moving_window.position.y + ui_state.currently_moving_window.offset.y);
|
||||
|
||||
if !key_pressed(.MOUSE_LEFT) ui_state.currently_moving_window = null;
|
||||
|
||||
}
|
||||
|
||||
for *window: ui_state.windows {
|
||||
if window.last_used_frame_index != ui_state.frame_index continue;
|
||||
window.actual_position = window.position + window.offset;
|
||||
}
|
||||
|
||||
// SET ALL PIXEL AND TEXT SIZES
|
||||
for *box : ui_state.boxes {
|
||||
if box.semantic_size[0].size_kind == {
|
||||
@@ -1206,17 +1221,7 @@ ui_update_input :: () {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
ui_state.currently_moving_window.offset.x += xx engine.input.mouse.delta_x;
|
||||
ui_state.currently_moving_window.offset.y += xx engine.input.mouse.delta_y;
|
||||
ui_state.currently_moving_window.offset.x -= xx min(0, ui_state.currently_moving_window.position.x + ui_state.currently_moving_window.offset.x);
|
||||
ui_state.currently_moving_window.offset.y -= xx min(0, ui_state.currently_moving_window.position.y + ui_state.currently_moving_window.offset.y);
|
||||
|
||||
if !key_pressed(.MOUSE_LEFT) ui_state.currently_moving_window = null;
|
||||
}
|
||||
|
||||
for *window: ui_state.windows {
|
||||
if window.last_used_frame_index != ui_state.frame_index continue;
|
||||
window.actual_position = window.position + window.offset;
|
||||
|
||||
}
|
||||
|
||||
for *box: ui_state.boxes {
|
||||
|
||||
@@ -128,7 +128,7 @@ ui_textfield :: (label: string, text: *string, identifier: s64 = 0, loc := #call
|
||||
ui_set_next_border_color(.{0.3,0.3,0.3,1.0});
|
||||
ui_set_next_size_x(.PCT, 1);
|
||||
|
||||
text_size := get_text_size(engine.renderer, <<text, ui_state.fonts.button);
|
||||
text_size := get_text_size(engine.renderer, "E", ui_state.fonts.button);
|
||||
|
||||
ui_set_next_size_y(.PIXELS, text_size.y); // TODO
|
||||
ui_set_next_padding(5);
|
||||
|
||||
Reference in New Issue
Block a user