This commit is contained in:
2025-02-24 21:04:17 -06:00
commit 6bd1c44fc8
23 changed files with 367 additions and 0 deletions

69
game/game.odin Normal file
View File

@@ -0,0 +1,69 @@
package game
import "core:fmt"
import rl "vendor:raylib"
player : Player
world : World
main :: proc() {
rl.InitWindow(1280, 720, "Odin game")
player.position.x = CELL_SIZE * 5
player.position.y = CELL_SIZE * 5
load_tilemap()
defer unload_tilemap()
fill_world_grid_with_nothing(&world)
t := Tile {
type = .WALL,
color = rl.WHITE,
tilemap_pos = {0,1},
}
t2 := Tile {
type = .WALL,
color = rl.WHITE,
tilemap_pos = {0,1},
}
t3 := Tile {
type = .WALL,
color = rl.WHITE,
tilemap_pos = {0,1},
}
set_grid_tile(&world, {3,3}, t)
set_grid_tile(&world, {3,4}, t2)
set_grid_tile(&world, {3,5}, t3)
fmt.println(world.grid[3][3])
game_loop()
}
game_loop :: proc() {
for !rl.WindowShouldClose() {
update()
rl.BeginDrawing()
rl.ClearBackground(rl.BLACK)
draw()
rl.EndDrawing()
}
}
update :: proc() {
handle_player_input(&player)
}
draw :: proc() {
draw_player(&player)
draw_world(&world)
}