Checkboxerino
This commit is contained in:
@@ -57,7 +57,7 @@ editor_ui :: () {
|
||||
}
|
||||
|
||||
ui_window_begin("Entities", 1, 5, 200, 600);
|
||||
test = ui_checkbox(test);
|
||||
ui_checkbox(*test);
|
||||
if engine.current_scene != null {
|
||||
for engine.current_scene.entities {
|
||||
if it.flags & .DELETED continue;
|
||||
|
||||
@@ -151,7 +151,9 @@ generate_member_ui :: (type: *Type_Info_Struct, builder: *String_Builder, path:
|
||||
generate_member_ui(info_struct, builder, new_path);
|
||||
}
|
||||
}
|
||||
//case .BOOL; #through;
|
||||
case .BOOL; {
|
||||
print_to_builder(builder, "\tui_checkbox_field(tprint(\"%\"), *e.%);\n", new_path, new_path);
|
||||
}
|
||||
case .STRING; {
|
||||
print_to_builder(builder, "\tui_textfield(tprint(\"%\"), *e.%);\n", new_path, new_path);
|
||||
//ui_textfield :: (label: string, text: *string, identifier: s64 = 0, loc := #caller_location) {
|
||||
|
||||
@@ -29,7 +29,7 @@ ui_button :: (text: string, identifier: s64 = 0, loc := #caller_location) -> cli
|
||||
return box.interaction.clicked, box.interaction;
|
||||
}
|
||||
|
||||
ui_checkbox :: (checked: bool, identifier: s64 = 0, loc := #caller_location) -> bool {
|
||||
ui_checkbox :: (checked: *bool, identifier: s64 = 0, loc := #caller_location) -> bool {
|
||||
ui_set_next_background_color(.{0.2,0.2,0.2,1});
|
||||
ui_set_next_text_color(.{1,1,1,1});
|
||||
ui_set_next_size_x(.PIXELS, 12);
|
||||
@@ -41,7 +41,7 @@ ui_checkbox :: (checked: bool, identifier: s64 = 0, loc := #caller_location) ->
|
||||
box := ui_box_make(.CLICKABLE | .DRAW_BORDER | .DRAW_TEXT | .DRAW_BACKGROUND, get_hash(loc, identifier));
|
||||
ui_push_parent(box, .LEFT, .HORIZONTAL);
|
||||
{
|
||||
if checked {
|
||||
if checked.* {
|
||||
ui_set_next_size_x(.PCT, 1);
|
||||
ui_set_next_size_y(.PCT, 1);
|
||||
ui_set_next_background_color(.{0.4,0.4,0.4,1});
|
||||
@@ -51,10 +51,23 @@ ui_checkbox :: (checked: bool, identifier: s64 = 0, loc := #caller_location) ->
|
||||
ui_pop_parent();
|
||||
|
||||
if box.interaction.clicked {
|
||||
return !checked;
|
||||
checked.* = !checked.*;
|
||||
}
|
||||
|
||||
return checked;
|
||||
return checked.*;
|
||||
}
|
||||
|
||||
ui_checkbox_field :: (label: string, value: *bool, identifier: s64 = 0, loc := #caller_location) -> bool {
|
||||
changed := false;
|
||||
ui_container_layout(identifier=identifier, loc=loc);
|
||||
ui_push_parent(ui_state.last_box, .LEFT, .HORIZONTAL);
|
||||
{
|
||||
ui_label(label);
|
||||
ui_checkbox(value, identifier);
|
||||
}
|
||||
ui_pop_parent();
|
||||
|
||||
return value.*;
|
||||
}
|
||||
|
||||
ui_button_with_texture :: (texture_handle: Texture_Handle, identifier: s64 = 0, loc := #caller_location) -> clicked: bool, Interaction_State {
|
||||
|
||||
Reference in New Issue
Block a user