Init
This commit is contained in:
69
game/game.odin
Normal file
69
game/game.odin
Normal 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)
|
||||
}
|
||||
Reference in New Issue
Block a user