create basic tilemap

This commit is contained in:
2026-07-01 01:13:15 -07:00
parent bb25247c43
commit 8fb1ec1dcb
4 changed files with 74 additions and 1 deletions
+12 -1
View File
@@ -5,10 +5,16 @@ import rl "vendor:raylib"
Game :: struct {
running: bool,
time: f32, // total time elapsed
tilemap: Tilemap,
}
game_init :: proc() -> Game {
return Game{running = true, time = 0}
g := Game {
running = true,
time = 0,
}
g.tilemap = tilemap_init()
return g
}
game_update :: proc(g: ^Game, dt: f32) {
@@ -20,8 +26,13 @@ game_update :: proc(g: ^Game, dt: f32) {
}
game_draw :: proc(g: ^Game) {
tilemap_draw(&g.tilemap)
fps := rl.GetFPS()
rl.DrawText(rl.TextFormat("FPS: %i", fps), 10, 36, 20, rl.GREEN)
rl.DrawText(rl.TextFormat("Time: %.1fs", g.time), 10, 62, 20, rl.GRAY)
}
game_shutdown :: proc(g: ^Game) {
tilemap_destroy(&g.tilemap)
}