diff --git a/game/game b/game/game index 1790400..9f483db 100755 Binary files a/game/game and b/game/game differ diff --git a/game/game.odin b/game/game.odin index 077720f..aaff83a 100644 --- a/game/game.odin +++ b/game/game.odin @@ -29,7 +29,7 @@ main :: proc() { player = { position = {CELL_SIZE * 10, CELL_SIZE * 10}, camera = { - zoom = 2, + zoom = 3, target = {player.position.x + (CELL_SIZE / 2), player.position.y + (CELL_SIZE / 2)}, offset = {f32(rl.GetScreenWidth()) / 2, f32(rl.GetScreenHeight()) / 2}, }, diff --git a/game/player.odin b/game/player.odin index 922b628..88f06aa 100644 --- a/game/player.odin +++ b/game/player.odin @@ -55,8 +55,6 @@ player_update_chunks :: proc(p: ^Player, w: ^World) { current_player_chunk.position.y + dir.y } - fmt.printfln("Checking adjacent chunk at: %v", adjacent_pos) - get_chunk(w, adjacent_pos) } @@ -79,7 +77,6 @@ player_update_chunks :: proc(p: ^Player, w: ^World) { } if !is_adjacent { - fmt.printfln("Unloading chunk at: %v", chunk_pos) unload_chunk(chunk_pos, w) } } @@ -89,7 +86,7 @@ handle_player_input :: proc(p:^Player, w:^World) { target_pos := get_player_grid_position(p) dt := rl.GetFrameTime() - move_delay : f32 = 0.1 + move_delay : f32 = 0.2 if p.move_timer > 0 { p.move_timer -= dt diff --git a/game/world.odin b/game/world.odin index 0158458..5044b55 100644 --- a/game/world.odin +++ b/game/world.odin @@ -55,7 +55,7 @@ save_world :: proc(w:^World) { panic("World has invalid data_path") } - fmt.printfln("Saving world %v", w.data_dir) + // fmt.printfln("Saving world %v", w.data_dir) for chunk in w.chunks { save_chunk(get_chunk(w, chunk), w) @@ -66,7 +66,7 @@ save_chunk :: proc(c:^Chunk, w:^World) { chunk_dir := fmt.tprintf("%v/%v", w.data_dir, "chunks") filename := fmt.tprintf("%v/%v_%v.chunk", chunk_dir, c.position.x, c.position.y) - fmt.printfln("Saving chunk: %v", filename) + // fmt.printfln("Saving chunk: %v", filename) data := make([dynamic]u8) @@ -96,7 +96,7 @@ load_chunk :: proc(pos:Vec2i, w:^World) -> Chunk { data, err := os.read_entire_file_from_filename_or_err(filename) if err != nil { - fmt.printfln("No chunk %v found, generating new chunk", pos) + // fmt.printfln("No chunk %v found, generating new chunk", pos) chunk := generate_chunk(pos) save_chunk(&chunk, w) return chunk diff --git a/tests/test b/tests/test deleted file mode 100755 index cf5229d..0000000 Binary files a/tests/test and /dev/null differ diff --git a/tests/test.odin b/tests/test.odin deleted file mode 100644 index 466eefc..0000000 --- a/tests/test.odin +++ /dev/null @@ -1,91 +0,0 @@ -package test - -import "core:fmt" -import "core:os" -import "core:slice" - -my_enum :: enum { - val1,val2, -} - -my_struct :: struct { - me: my_enum, - num: i32, - v: Vec2i -} - -main :: proc() { - final_val:my_struct - - make_struct() - - data := load_file("test1") - if data != nil { - if len(data) == size_of(my_struct) { - static_bytes: [size_of(my_struct)]u8 - copy(static_bytes[:], data) - final_val = from_bytes(my_struct, static_bytes) - } - } - - fmt.printfln("Decoded Val: %v", final_val) -} - -make_struct :: proc() { - ms := my_struct { - me = .val1, - num = 345, - v = {45,75} - } - - fmt.printfln("Initial value: %v", ms) - - bytes := to_bytes(ms) - - fmt.printfln("Bytes: %v", bytes) - save_file("test1", bytes[:]) -} - -load_file :: proc(path:string) -> []u8 { - if !os.is_file(path) { - fmt.printfln("File not found") - return nil - } - - data, err := os.read_entire_file_from_filename_or_err(path) - if err != nil { - fmt.printfln("File read error: %v", err) - return nil - } - - fmt.printfln("Loading file: %v", path) - return data -} - -save_file :: proc(path:string, data:[]u8) { - err := os.write_entire_file_or_err(path, data) - if err != nil { - fmt.printfln("File write error: %v", err) - return - } - - fmt.printfln("Wrote file: %v", path) -} - -Vec2i :: struct { - x: i32, - y: i32, -} - -to_bytes :: proc(v: $T) -> [size_of(T)]u8 { - val := v - encoded_bytes := (^[size_of(T)]u8)(&val) - return encoded_bytes^ -} - -from_bytes :: proc($T:typeid, data: [size_of(T)]u8) -> T { - bytes := data - decoded_value := (^T)(&bytes)^ - return decoded_value -} - diff --git a/tests/test1 b/tests/test1 deleted file mode 100644 index 42421a2..0000000 Binary files a/tests/test1 and /dev/null differ