Checkbox time

This commit is contained in:
2025-01-01 01:49:44 +01:00
parent 3465acd673
commit 939fb58ac9
2 changed files with 21 additions and 0 deletions

View File

@@ -29,6 +29,26 @@ 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_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, 20);
ui_set_next_size_y(.PIXELS, 20);
ui_set_next_padding(5);
//ui_set_next_text_alignment(CENTER_HORIZONTALLY | .CENTER_VERTICALLY);
box := ui_box_make(.CLICKABLE | .DRAW_BORDER | .DRAW_TEXT | .DRAW_BACKGROUND | .ANIMATE_ON_HOVER, get_hash(loc, identifier));
ui_push_parent(box, .LEFT, .HORIZONTAL);
{
//ui_set_next_padding(5);
ui_set_next_background_color(.{1.0,1.0,1.0,1});
inner_box := ui_box_make(.DRAW_TEXT | .DRAW_BACKGROUND, get_hash(loc, 1));
}
ui_pop_parent();
return box.interaction.clicked;
}
ui_button_with_texture :: (texture_handle: Texture_Handle, identifier: s64 = 0, loc := #caller_location) -> clicked: bool, Interaction_State {
ui_set_next_texture(texture_handle);
ui_set_next_size_x(.PIXELS, 20);