post vet cleanup
This commit is contained in:
parent
5b01ad22f4
commit
67e37e2a3d
5 changed files with 8 additions and 19 deletions
|
|
@ -189,7 +189,7 @@ animation_draw :: proc(animation: ^Animation, global_transform: mat3, mode: Anim
|
||||||
transform := linalg.identity(mat3)
|
transform := linalg.identity(mat3)
|
||||||
matrices := slice.reinterpret([]mat3, animation.matrices[:animation.matrix_count * 9])
|
matrices := slice.reinterpret([]mat3, animation.matrices[:animation.matrix_count * 9])
|
||||||
for mat, i in matrices {
|
for mat, i in matrices {
|
||||||
transform *= mat
|
transform = mat * transform
|
||||||
rectangles[i + 1] = rectangle_corners_transform_mat3(transform, animation.shapes.rectangle)
|
rectangles[i + 1] = rectangle_corners_transform_mat3(transform, animation.shapes.rectangle)
|
||||||
}
|
}
|
||||||
if animation.matrix_count == 0 {
|
if animation.matrix_count == 0 {
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,6 @@
|
||||||
package game
|
package game
|
||||||
|
|
||||||
import rl "libraries/raylib"
|
import rl "libraries/raylib"
|
||||||
import "base:runtime"
|
|
||||||
|
|
||||||
WINDOW_WIDTH :: 1280
|
WINDOW_WIDTH :: 1280
|
||||||
WINDOW_HEIGHT :: 720
|
WINDOW_HEIGHT :: 720
|
||||||
|
|
|
||||||
|
|
@ -333,8 +333,6 @@ matrix_pool_get_mat3 :: proc() -> (value_strings: []InputFloatField, values: []f
|
||||||
|
|
||||||
matrix_move_to :: proc(floats: []f32, inputs: []InputFloatField, from, to: int) {
|
matrix_move_to :: proc(floats: []f32, inputs: []InputFloatField, from, to: int) {
|
||||||
if from == to do return
|
if from == to do return
|
||||||
floats := program.matrix_float_pool
|
|
||||||
inputs := program.matrix_value_string_pool
|
|
||||||
floats_values_size := size_of(f32) * 9
|
floats_values_size := size_of(f32) * 9
|
||||||
inputs_buffer_size := size_of(InputFloatField) * 9
|
inputs_buffer_size := size_of(InputFloatField) * 9
|
||||||
floats_moving_matrix := &floats[from * 9]
|
floats_moving_matrix := &floats[from * 9]
|
||||||
|
|
@ -460,7 +458,6 @@ program_get_master_matrix :: proc() -> mat3 {
|
||||||
|
|
||||||
program_set_animation_state :: proc(state: ProgramAnimationState) {
|
program_set_animation_state :: proc(state: ProgramAnimationState) {
|
||||||
if program.animation_state == state do return
|
if program.animation_state == state do return
|
||||||
previous_state := program.animation_state
|
|
||||||
program.animation_state = state
|
program.animation_state = state
|
||||||
switch program.animation_state {
|
switch program.animation_state {
|
||||||
case .Ready:
|
case .Ready:
|
||||||
|
|
@ -817,9 +814,7 @@ program_build_workspace_ui :: proc(ctx: ^ui.Context) -> (elements: []ui.Element,
|
||||||
top_bar_inner_height := ui.get_element_inner_area(top_bar_container^).height
|
top_bar_inner_height := ui.get_element_inner_area(top_bar_container^).height
|
||||||
top_bar_button_width := ui.Size_Pixels(top_bar_inner_height)
|
top_bar_button_width := ui.Size_Pixels(top_bar_inner_height)
|
||||||
top_bar_button_dimensions := ui.Dimensions {top_bar_button_width, ui.Size_Percentage(1.0)}
|
top_bar_button_dimensions := ui.Dimensions {top_bar_button_width, ui.Size_Percentage(1.0)}
|
||||||
top_bar_button_config := ui.ElementConfiguration {margin = top_bar_element_margin}
|
|
||||||
top_bar_dropdown_dimensions := ui.Dimensions {ui.Size_Pixels(160.0), ui.Size_Percentage(1.0)}
|
|
||||||
top_bar_dropdown_config := ui.ElementConfiguration {margin = top_bar_element_margin}
|
|
||||||
{
|
{
|
||||||
button_margin := top_bar_element_margin
|
button_margin := top_bar_element_margin
|
||||||
button_config: ui.ElementConfiguration
|
button_config: ui.ElementConfiguration
|
||||||
|
|
@ -898,7 +893,6 @@ program_build_workspace_ui :: proc(ctx: ^ui.Context) -> (elements: []ui.Element,
|
||||||
ui.same_line()
|
ui.same_line()
|
||||||
ui.element(.Divider, divider_dimensions, divider_config)
|
ui.element(.Divider, divider_dimensions, divider_config)
|
||||||
|
|
||||||
play_button_label: cstring
|
|
||||||
button_data = new(UiElementData_Button, context.temp_allocator)
|
button_data = new(UiElementData_Button, context.temp_allocator)
|
||||||
switch program.animation_state {
|
switch program.animation_state {
|
||||||
case .Ready:
|
case .Ready:
|
||||||
|
|
@ -1054,7 +1048,6 @@ program_handle_mouse :: proc(mouse_state: MouseState, top_bar_container, matrix_
|
||||||
break state_label
|
break state_label
|
||||||
}
|
}
|
||||||
draggable := program.mouse_current_draggable
|
draggable := program.mouse_current_draggable
|
||||||
position := matrix3_transform_xy(world_to_grid_matrix, mouse)
|
|
||||||
drag_to_position := matrix3_transform_xy(world_to_grid_matrix, mouse)
|
drag_to_position := matrix3_transform_xy(world_to_grid_matrix, mouse)
|
||||||
if program.grid_snap {
|
if program.grid_snap {
|
||||||
grid_line_sep := grid_get_line_separation(program.grid.zoom, program.grid.cell_size_px)
|
grid_line_sep := grid_get_line_separation(program.grid.zoom, program.grid.cell_size_px)
|
||||||
|
|
@ -1133,8 +1126,7 @@ program_render_ui_and_handle_focus :: proc(ctx: ^ui.Context, focus_element_id: u
|
||||||
animation_matrix_index := animation_get_eased_progress(program.animation)
|
animation_matrix_index := animation_get_eased_progress(program.animation)
|
||||||
matrix_animation_distance := element_matrix_index - animation_matrix_index
|
matrix_animation_distance := element_matrix_index - animation_matrix_index
|
||||||
alpha := max(0.0, 1.0 - abs(matrix_animation_distance))
|
alpha := max(0.0, 1.0 - abs(matrix_animation_distance))
|
||||||
color := rl.Color{128, 255, 128, u8(alpha * 64.0)}
|
rl.DrawRectangleRec(area, rl.Color{128, 255, 128, u8(alpha * 64.0)})
|
||||||
rl.DrawRectangleRec(area, color)
|
|
||||||
|
|
||||||
matrix_area := ui.rect_grow(ui.rect2(area), element.margin / 2.0)
|
matrix_area := ui.rect_grow(ui.rect2(area), element.margin / 2.0)
|
||||||
tl, tr, br, bl := ui.rect_get_corners(matrix_area)
|
tl, tr, br, bl := ui.rect_get_corners(matrix_area)
|
||||||
|
|
@ -1281,7 +1273,7 @@ program_render_ui_and_handle_focus :: proc(ctx: ^ui.Context, focus_element_id: u
|
||||||
rl.DrawRectangleRec(rect2(ui.get_element_outer_area(element)), color)
|
rl.DrawRectangleRec(rect2(ui.get_element_outer_area(element)), color)
|
||||||
case .ToggleGroup:
|
case .ToggleGroup:
|
||||||
data := cast(^UiElementData_ToggleGroup)element.data
|
data := cast(^UiElementData_ToggleGroup)element.data
|
||||||
tooltips := strings.string_from_ptr(transmute(^byte)element.tooltip, len(element.tooltip))
|
tooltips := strings.string_from_ptr(cast(^byte)element.tooltip, len(element.tooltip))
|
||||||
area_individual := area
|
area_individual := area
|
||||||
area_individual.width /= f32(strings.count(tooltips, ";") + 1)
|
area_individual.width /= f32(strings.count(tooltips, ";") + 1)
|
||||||
mouse := rl.GetMousePosition()
|
mouse := rl.GetMousePosition()
|
||||||
|
|
@ -1384,8 +1376,7 @@ ui_mat3 :: proc(idx: int, mat: []f32, value_strings: []InputFloatField, dimensio
|
||||||
}
|
}
|
||||||
|
|
||||||
ui_labeled_input_float_element :: proc(label: cstring, margin: f32, value: ^f32, value_string: ^InputFloatField, allocator := context.temp_allocator) -> ^ui.Element {
|
ui_labeled_input_float_element :: proc(label: cstring, margin: f32, value: ^f32, value_string: ^InputFloatField, allocator := context.temp_allocator) -> ^ui.Element {
|
||||||
label := fmt.ctprintf("%s: ", label)
|
label_element := ui.element(.Label, {}, {label = fmt.ctprintf("%s: ", label), color = ui.col(rl.WHITE), margin = margin})
|
||||||
label_element := ui.element(.Label, {}, {label = label, color = ui.col(rl.WHITE), margin = margin})
|
|
||||||
dimensions := ui.Dimensions{ui.Size_Pixels(64.0), ui.dimensions_pixels(ui.rect_get_size(ui.get_element_outer_area(label_element^))).height}
|
dimensions := ui.Dimensions{ui.Size_Pixels(64.0), ui.dimensions_pixels(ui.rect_get_size(ui.get_element_outer_area(label_element^))).height}
|
||||||
ui.same_line()
|
ui.same_line()
|
||||||
input_data := new(UiElementData_FloatInput, context.temp_allocator)
|
input_data := new(UiElementData_FloatInput, context.temp_allocator)
|
||||||
|
|
@ -1394,8 +1385,7 @@ ui_labeled_input_float_element :: proc(label: cstring, margin: f32, value: ^f32,
|
||||||
}
|
}
|
||||||
|
|
||||||
ui_labeled_input_text_element :: proc(label: cstring, margin: f32, str: []byte, allocator := context.temp_allocator) -> ^ui.Element {
|
ui_labeled_input_text_element :: proc(label: cstring, margin: f32, str: []byte, allocator := context.temp_allocator) -> ^ui.Element {
|
||||||
label := fmt.ctprintf("%s: ", label)
|
label_element := ui.element(.Label, {}, {label = fmt.ctprintf("%s: ", label), color = ui.col(rl.WHITE), margin = margin})
|
||||||
label_element := ui.element(.Label, {}, {label = label, color = ui.col(rl.WHITE), margin = margin})
|
|
||||||
dimensions := ui.Dimensions{ui.Size_Pixels(224.0), ui.dimensions_pixels(ui.rect_get_size(ui.get_element_outer_area(label_element^))).height}
|
dimensions := ui.Dimensions{ui.Size_Pixels(224.0), ui.dimensions_pixels(ui.rect_get_size(ui.get_element_outer_area(label_element^))).height}
|
||||||
ui.same_line()
|
ui.same_line()
|
||||||
input_data := new(UiElementData_TextInput, context.temp_allocator)
|
input_data := new(UiElementData_TextInput, context.temp_allocator)
|
||||||
|
|
|
||||||
|
|
@ -47,7 +47,7 @@ _project_read :: proc(project: ^ProjectData, path: string) -> ProjectReadError {
|
||||||
r := io.to_reader(os.to_stream(f))
|
r := io.to_reader(os.to_stream(f))
|
||||||
header := PROJECT_DATA_HEADER
|
header := PROJECT_DATA_HEADER
|
||||||
header_buffer: [len(PROJECT_DATA_HEADER)]byte
|
header_buffer: [len(PROJECT_DATA_HEADER)]byte
|
||||||
if num, err := io.read_full(r, header_buffer[:]); err != nil {
|
if _, err := io.read_full(r, header_buffer[:]); err != nil {
|
||||||
return ProjectReadErrorType.FailedReadingHeader
|
return ProjectReadErrorType.FailedReadingHeader
|
||||||
}
|
}
|
||||||
if mem.compare(transmute([]byte)header, header_buffer[:]) != 0 {
|
if mem.compare(transmute([]byte)header, header_buffer[:]) != 0 {
|
||||||
|
|
|
||||||
|
|
@ -132,7 +132,7 @@ V2_DOWN :: v2{0.0, 1.0}
|
||||||
/// ### ENUM STRINGIFICATION ### ///
|
/// ### ENUM STRINGIFICATION ### ///
|
||||||
enum_to_raygui_options_string :: proc($T: typeid, allocator: mem.Allocator) -> cstring where IS_ENUM(T) {
|
enum_to_raygui_options_string :: proc($T: typeid, allocator: mem.Allocator) -> cstring where IS_ENUM(T) {
|
||||||
b := strings.builder_make(allocator)
|
b := strings.builder_make(allocator)
|
||||||
for element, i in T {
|
for element in T {
|
||||||
option := fmt.aprint(element, allocator = allocator)
|
option := fmt.aprint(element, allocator = allocator)
|
||||||
fmt.sbprint(&b, strings.to_ada_case(option, allocator), ";", sep = "")
|
fmt.sbprint(&b, strings.to_ada_case(option, allocator), ";", sep = "")
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue