UI fixes and new layout features
This commit is contained in:
@@ -98,6 +98,16 @@ ui_label :: (text: string, text_color: Color = .{1,1,1,1}, identifier: s64 = 0,
|
||||
box := ui_box_make(.DRAW_TEXT, get_hash(loc, identifier));
|
||||
}
|
||||
|
||||
ui_label_for_fields :: (text: string, text_color: Color = .{1,1,1,1}, identifier: s64 = 0, loc := #caller_location) {
|
||||
ui_set_next_text(text);
|
||||
ui_set_next_background_color(.{0.0,1.0,1.0,0.0});
|
||||
ui_set_next_text_color(text_color);
|
||||
ui_set_next_size_x(.PCT, 0.5);
|
||||
ui_set_next_size_y(.TEXT_DIM);
|
||||
ui_set_next_padding(5);
|
||||
box := ui_box_make(.DRAW_TEXT, get_hash(loc, identifier));
|
||||
}
|
||||
|
||||
ui_label_fill_parent_x :: (text: string, identifier: s64 = 0, loc := #caller_location) {
|
||||
ui_set_next_text(text);
|
||||
ui_set_next_background_color(.{0.0,1.0,1.0,0.0});
|
||||
@@ -288,7 +298,6 @@ ui_int_field :: (label: string, value: *int, identifier: s64 = 0, loc := #caller
|
||||
ui_float_field :: (label: string, value: *float, identifier: s64 = 0, loc := #caller_location) -> bool {
|
||||
changed := false;
|
||||
ui_container_layout(identifier=identifier, loc=loc);
|
||||
ui_set_next_size_x(.CHILDREN_SUM);
|
||||
ui_push_parent(ui_state.last_box, .LEFT, .HORIZONTAL);
|
||||
{
|
||||
ui_label(label);
|
||||
@@ -425,16 +434,27 @@ ui_float_field :: (value: *float, identifier: s64 = 0, loc := #caller_location)
|
||||
|
||||
ui_vector_field :: (label: string, value: *Vector3, identifier: s64 = 0, loc := #caller_location) -> bool {
|
||||
changed := false;
|
||||
ui_set_next_size_x(.TEXT_DIM);
|
||||
ui_set_next_size_y(.TEXT_DIM);
|
||||
ui_container_layout(identifier=identifier, loc=loc);
|
||||
ui_push_parent(ui_state.last_box, .LEFT, .HORIZONTAL);
|
||||
{
|
||||
ui_label(label);
|
||||
ui_label_for_fields(label);
|
||||
|
||||
//ui_set_next_size_x(.PCT, 0.5);
|
||||
//ui_set_next_size_y(.CHILDREN_SUM);
|
||||
|
||||
//container := ui_box_make(0, get_hash(loc, 123));
|
||||
//ui_push_parent(ui_state.last_box, .LEFT, .HORIZONTAL);
|
||||
|
||||
ui_label("X");
|
||||
changed |= ui_float_field(*value.x);
|
||||
ui_label("Y");
|
||||
changed |= ui_float_field(*value.y);
|
||||
ui_label("Z");
|
||||
changed |= ui_float_field(*value.z);
|
||||
|
||||
//ui_pop_parent();
|
||||
}
|
||||
ui_pop_parent();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user