48 lines
1.1 KiB
Odin
48 lines
1.1 KiB
Odin
package test
|
|
|
|
import game "../game"
|
|
import "core:fmt"
|
|
import rl "vendor:raylib"
|
|
import "core:encoding/endian"
|
|
|
|
main :: proc() {
|
|
|
|
buf : [128]u8
|
|
my_int : i32 = -32
|
|
|
|
endian.put_i32(buf[:], .Little, my_int)
|
|
|
|
fmt.printfln("u8 buffer: %v", buf)
|
|
|
|
decoded_int, err := endian.get_i32(buf[:], .Little)
|
|
|
|
fmt.printfln("Pre-encoding: %v | Decoded int: %v", my_int, decoded_int)
|
|
|
|
// nothing := game.Tile {
|
|
// type = .NOTHING,
|
|
// color = rl.RED,
|
|
// tilemap_pos = {3,3},
|
|
// resource = .NOTHING,
|
|
// interaction = .NOTHING,
|
|
// }
|
|
|
|
// ts := game.serialize_tile(nothing)
|
|
|
|
// fmt.printfln("Expecting size: %v, Got size: %v", size_of(game.Tile), len(ts))
|
|
// fmt.printfln("Pre-serialized Tile: %v", nothing)
|
|
|
|
// dst := game.deserialize_tile(ts)
|
|
// fmt.printfln("Post-serialized tile: %v", dst)
|
|
|
|
// y : int
|
|
// chunk := game.Chunk {
|
|
// position = {0,1}
|
|
// }
|
|
|
|
// for x in 0..<len(chunk.tiles) {
|
|
// for y in 0..<len(chunk.tiles) {
|
|
// chunk.tiles[x][y] = nothing
|
|
// }
|
|
// }
|
|
}
|