build #1

Merged
Synthasmagoria merged 24 commits from build into master 2026-09-15 13:38:54 +00:00
2 changed files with 24 additions and 4 deletions
Showing only changes of commit 9aee47c12c - Show all commits

Animation modes - part 2

Synthasmagoria 2026-09-09 05:58:33 +02:00

View file

@ -239,7 +239,14 @@ animation_draw :: proc(animation: Animation, global_transform: mat3, mode: Anima
rectangle_current_color := linalg.lerp(color_origin, color_end, animation_progress_fraction)
draw_animation_rectangle_corners(rectangle_current, rl.Color(rectangle_current_color))
case .All:
animation_progress := math.clamp(animation.matrix_index / f32(animation.matrix_count), 0.0, 1.0)
animation_progress = ease.ease(animation.ease, animation_progress)
color := linalg.lerp(color_origin, color_end, animation_progress)
rectangle_end := rectangle_corners_transform_mat3(transform, animation.shapes.rectangle)
rectangle_end_world := rectangle_corners_transform_mat3(global_transform, rectangle_end)
rectangle_origin_world := rectangle_corners_transform_mat3(global_transform, animation.shapes.rectangle)
rectangle := rectangle_corners_lerp(rectangle_origin_world, rectangle_end_world, animation_progress)
draw_animation_rectangle_corners(rectangle, rl.Color(color))
}
}
}

View file

@ -878,8 +878,11 @@ program_build_workspace_ui :: proc(ctx: ^ui.Context) -> (elements: []ui.Element,
ui.same_line()
ui.element(.Label, ui.dimensions_auto(), label_config)
toggle_group_config := ui.ElementConfiguration{margin = button_margin, label = enum_to_raygui_options_string(AnimationMode, context.temp_allocator)}
toggle_group_dimensions := ui.Dimensions{top_bar_button_width * 2.0, ui.Size_Percentage(1.0)}
toggle_group_config := ui.ElementConfiguration{
margin = button_margin,
label = enum_to_raygui_options_string(AnimationMode, context.temp_allocator),
tooltip = "Play animation\nstep by step;Play animation using the\nfull transformation matrix"}
toggle_group_dimensions := ui.Dimensions{top_bar_button_width * 3.0, ui.Size_Percentage(1.0)}
toggle_group_data: ^UiElementData_ToggleGroup
toggle_group_data = new(UiElementData_ToggleGroup, context.temp_allocator)
toggle_group_data^ = {value = cast(^i32)&program.animation_mode}
@ -1170,7 +1173,17 @@ program_render_ui_and_handle_focus :: proc(ctx: ^ui.Context, focus_element_id: u
rl.DrawRectangleRec(rect2(ui.get_element_outer_area(element)), color)
case .ToggleGroup:
data := cast(^UiElementData_ToggleGroup)element.data
rl.GuiToggleGroup(area, element.label, data.value)
tooltips := strings.string_from_ptr(transmute(^byte)element.tooltip, len(element.tooltip))
area_individual := area
area_individual.width /= f32(strings.count(tooltips, ";") + 1)
mouse := rl.GetMousePosition()
rl.GuiToggleGroup(area_individual, element.label, data.value)
if len(element.tooltip) > 0 && rect_has_point(area, mouse) {
tooltips_split := strings.split(tooltips, ";", context.temp_allocator)
tooltip_index := int((mouse.x - area_individual.x) / area_individual.width)
tooltip_text = strings.clone_to_cstring(tooltips_split[tooltip_index], context.temp_allocator)
tooltip_position = mouse
}
case:
rl.DrawRectangleRec(area, rl.MAGENTA)
}