diff --git a/TODO.MD b/TODO.MD index 797fef5..a637c0c 100644 --- a/TODO.MD +++ b/TODO.MD @@ -1,5 +1,4 @@ - Centered justification in UI - Make web build -- Center line - Zoom sensitivity - Web read/write diff --git a/src/grid.odin b/src/grid.odin index a0a1aaa..98909a9 100644 --- a/src/grid.odin +++ b/src/grid.odin @@ -79,9 +79,7 @@ draw_grid :: proc(grid: Grid, area, text_draw, text_clip: rect2, color: rl.Color } } - if rect_has_point(rect_from_area(tl, br), v2(0)) { - origin := matrix3_transform_xy(grid_to_world_matrix, v2(0)) - rl.DrawLineV({area.x, origin.y}, {area.x + area.width, origin.y}, origin_color) - rl.DrawLineV({origin.x, area.y}, {origin.x, area.y + area.height}, origin_color) - } + origin := matrix3_transform_xy(grid_to_world_matrix, v2(0)) + rl.DrawLineV({area.x, origin.y}, {area.x + area.width, origin.y}, origin_color) + rl.DrawLineV({origin.x, area.y}, {origin.x, area.y + area.height}, origin_color) } diff --git a/src/main.odin b/src/main.odin index 7fb9ddf..28237a7 100644 --- a/src/main.odin +++ b/src/main.odin @@ -34,7 +34,7 @@ shutdown :: proc() { should_run :: proc() -> bool { when ODIN_OS != .JS { - if rl.WindowShouldClose() { + if program.window_should_close { return false } } diff --git a/src/program.odin b/src/program.odin index e6676b2..27b677f 100644 --- a/src/program.odin +++ b/src/program.odin @@ -34,6 +34,7 @@ import "core:fmt" import "core:math" import "core:math/linalg" import "core:strings" +import "core:slice" RAYGUI_ICON_NEW :: "#009#" RAYGUI_ICON_SAVE :: "#002#" @@ -295,6 +296,7 @@ Program :: struct { animation: Animation, animation_state: ProgramAnimationState, animation_speed: f32, + window_should_close: bool, } float_slice_get_mat3 :: proc(floats: []f32, index: int) -> ^mat3 { @@ -370,8 +372,11 @@ program_load_project :: proc(program: ^Program, path: string) -> ProjectReadErro program.matrix_count = int(project.matrix_count) program.grid = project.grid program.animation.shapes = project.shapes - for val, i in program.matrix_float_pool[:program.matrix_count * 9] { - fmt.bprint(program.matrix_value_string_pool[i][:], val) + matrices := slice.reinterpret([]mat3, program.matrix_float_pool[:program.matrix_count * 9]) + for mat, i in matrices { + start := i * 9 + end := (i + 1) * 9 + write_matrix_to_values_and_value_strings(program.matrix_float_pool[start:end], program.matrix_value_string_pool[start:end], mat) } program.animation.matrix_count = program.matrix_count return nil @@ -386,7 +391,6 @@ program_show_dialog :: proc(program: ^Program, dialog_type: ProgramDialogType, m mem.set(&program.dialog_data, 0, size_of(program.dialog_data)) for i in 0.. f32 { - return val - math.trunc(val) + return abs(val - math.trunc(val)) } color_to_fcolor :: proc(color: rl.Color) -> [4]f32 {