ui_full_size_background :: (color: Color = .{0,0,0,1}, identifier: s64 = 0, loc := #caller_location) { ui_set_next_size_x(.PIXELS, xx engine.renderer.render_target_width); ui_set_next_size_y(.PIXELS, xx engine.renderer.render_target_height); ui_set_next_background_color(color); background := ui_box_make(.DRAW_BACKGROUND, hash=get_hash(loc, identifier)); } ui_container_layout :: (color: Color = .{0,0,0,0}, identifier: s64 = 0, loc := #caller_location) { ui_set_next_size_x(.CHILDREN_SUM); ui_set_next_size_y(.CHILDREN_SUM); ui_set_next_background_color(color); container := ui_box_make(.DRAW_BACKGROUND, hash=get_hash(loc, identifier)); } ui_button :: (text: string, identifier: s64 = 0, loc := #caller_location) -> clicked: bool, Interaction_State { ui_set_next_text(text); 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(.TEXT_DIM); ui_set_next_size_y(.TEXT_DIM); 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)); return box.interaction.clicked, box.interaction; } 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); ui_set_next_size_y(.PIXELS, 20); box := ui_box_make(.CLICKABLE | .DRAW_BACKGROUND | .ANIMATE_ON_HOVER, get_hash(loc, identifier)); return box.interaction.clicked, box.interaction; } ui_button_no_bg :: (text: string, identifier: s64 = 0, loc := #caller_location) -> clicked: bool, Interaction_State { ui_set_next_text(text); 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(.TEXT_DIM); ui_set_next_size_y(.TEXT_DIM); ui_set_next_padding(5); //ui_set_next_text_alignment(.CENTER_HORIZONTALLY | .CENTER_VERTICALLY); box := ui_box_make(.CLICKABLE | .DRAW_BORDER | .DRAW_TEXT | .ANIMATE_ON_HOVER, get_hash(loc, identifier)); return box.interaction.clicked, box.interaction; } ui_button_no_border :: (text: string, identifier: s64 = 0, loc := #caller_location) -> clicked: bool, Interaction_State { ui_set_next_text(text); 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(.TEXT_DIM); ui_set_next_size_y(.TEXT_DIM); ui_set_next_padding(5); //ui_set_next_text_alignment(.CENTER_HORIZONTALLY | .CENTER_VERTICALLY); box := ui_box_make(.CLICKABLE | .DRAW_BORDER | .DRAW_BACKGROUND | .DRAW_TEXT | .ANIMATE_ON_HOVER, get_hash(loc, identifier)); return box.interaction.clicked, box.interaction; } ui_toolbar_button :: (text: string, identifier: s64 = 0, loc := #caller_location) -> clicked: bool, Interaction_State { ui_set_next_text(text); ui_set_next_border_width(1); ui_set_next_border_color(.{0.5,0.5,0.5,1}); ui_set_next_background_color(.{0.1,0.1,0.1,1}); ui_set_next_text_color(.{1,1,1,1}); ui_set_next_size_x(.TEXT_DIM); ui_set_next_size_y(.TEXT_DIM); ui_set_next_padding_left(20); ui_set_next_padding_right(20); ui_set_next_padding_top(5); ui_set_next_padding_bottom(5); //ui_set_next_text_alignment(.CENTER_HORIZONTALLY | .CENTER_VERTICALLY); box := ui_box_make(.CLICKABLE | .DRAW_BORDER | .DRAW_TEXT | .ANIMATE_ON_HOVER, get_hash(loc, identifier)); return box.interaction.clicked, box.interaction; } ui_label_animated :: (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(.TEXT_DIM); ui_set_next_size_y(.TEXT_DIM); ui_set_next_padding(5); box := ui_box_make(.DRAW_TEXT | .ANIMATE_ON_HOVER, get_hash(loc, identifier)); } ui_label :: (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(.TEXT_DIM); 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}); ui_set_next_text_color(.{1,1,1,1}); ui_set_next_size_x(.PCT, 1); ui_set_next_size_y(.TEXT_DIM); ui_set_next_padding(5); //ui_set_next_text_alignment(.CENTER_VERTICALLY); box := ui_box_make(.DRAW_TEXT | .ANIMATE_ON_HOVER, get_hash(loc, identifier)); } ui_textfield :: (label: string, text: *string, identifier: s64 = 0, loc := #caller_location) { ui_container_layout(); ui_push_parent(ui_state.last_box, .LEFT, .HORIZONTAL); { ui_label(label); ui_set_next_background_color(.{0.0,1.0,1.0,0.0}); 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, < 0 { ui_set_next_text(< 0 { text.count -= 1; } } if key_down(.RETURN) { outer.interaction.editing = false; } if engine.input.has_char { new_str := alloc_string(text.count + 1); memcpy(new_str.data, text.data, text.count); new_str[new_str.count-1] = xx engine.input.current_char; free(< 0 { text_widget._number_text.count -= 1; } if key_down(.RETURN) { // FORMAT IT BACK! temp_str : string; temp_str.data = text_widget._number_text.data.data; temp_str.count = text_widget._number_text.count; < 0 { // text.count -= 1; // } // } // if key_down(.RETURN) { // outer.interaction.editing = false; // } // if engine.input.has_char { // new_str := alloc_string(text.count + 1); // memcpy(new_str.data, text.data, text.count); // new_str[new_str.count-1] = xx engine.input.current_char; // free(< clicked: bool, Interaction_State { ui_set_next_text(text); if selected { ui_set_next_background_color(.{0.5,0.5,0.5,1.0}); } else { ui_set_next_background_color(.{0.0,1.0,1.0,0.0}); } ui_set_next_text_color(.{1,1,1,1}); ui_set_next_size_x(.PCT, 1); ui_set_next_size_y(.TEXT_DIM); ui_set_next_padding(5); //ui_set_next_text_alignment(.CENTER_VERTICALLY); box := ui_box_make(.DRAW_BACKGROUND | .DRAW_TEXT | .ANIMATE_ON_HOVER | .CLICKABLE, get_hash(loc, identifier)); return box.interaction.clicked, box.interaction; } ui_toolbar :: (identifier: s64 = 0, loc := #caller_location) { ui_set_next_background_color(.{0.2,0.2,0.2,1}); ui_set_next_size_x(.PIXELS, xx engine.renderer.render_target_width); ui_set_next_size_y(.CHILDREN_SUM); box := ui_box_make(.DRAW_BACKGROUND | .DRAW_BORDER, get_hash(loc, identifier)); } ui_tab_title_bar :: (title: string, identifier: s64 = 0, loc := #caller_location) { ui_set_next_background_color(.{0.03, 0.03, 0.03, 1.0}); ui_set_next_padding(5); ui_set_next_size_y(.CHILDREN_SUM); parent := ui_box_make(.DRAW_BACKGROUND | .DRAW_BORDER, get_hash(loc, identifier)); ui_push_parent(parent, alignment=.LEFT, axis=.VERTICAL); { ui_set_next_text_alignment(.CENTER_VERTICALLY); ui_set_next_text(title); ui_set_next_text_color(.{1,1,1,1}); ui_set_next_size_x(.TEXT_DIM); ui_set_next_size_y(.TEXT_DIM); text := ui_box(.DRAW_TEXT); } ui_pop_parent(); } ui_texture :: (texture: Texture_Handle, identifier: s64 = 0, loc := #caller_location) { ui_set_next_texture(texture); ui_set_next_background_color(.{0.1,0.1,0.1,1}); box := ui_box_make(.DRAW_BACKGROUND | .DRAW_BORDER, get_hash(loc, identifier)); } ui_interactable_texture :: (texture: Texture_Handle, identifier: s64 = 0, loc := #caller_location) -> Interaction_State { ui_set_next_texture(texture); ui_set_next_background_color(.{0.1,0.1,0.1,1}); box := ui_box_make(.DRAW_BACKGROUND | .CLICKABLE, get_hash(loc, identifier)); return box.interaction; } ui_space :: (width: float, height: float, identifier: s64 = 0, loc := #caller_location) { ui_set_next_background_color(.{0,0,0,0}); ui_set_next_size_x(.PIXELS, width); ui_set_next_size_y(.PIXELS, height); box := ui_box_make(.NONE, get_hash(loc, identifier)); } ui_slider :: (value: *float, min: float = 0.0, max: float = 1.0, identifier: s64 = 0, loc := #caller_location) { 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(.PCT, 1.0); ui_set_next_size_y(.PIXELS, 15); ui_set_next_text_alignment(.CENTER_HORIZONTALLY | .CENTER_VERTICALLY); ui_set_next_text(tprint("%", <