Cleanup code and add initial player calls.
This commit is contained in:
+9
-10
@@ -4,6 +4,7 @@ import rl "vendor:raylib"
|
|||||||
|
|
||||||
Game :: struct {
|
Game :: struct {
|
||||||
assets: Asset_Manager,
|
assets: Asset_Manager,
|
||||||
|
player: Player
|
||||||
}
|
}
|
||||||
|
|
||||||
game_init :: proc() -> Game {
|
game_init :: proc() -> Game {
|
||||||
@@ -12,12 +13,11 @@ game_init :: proc() -> Game {
|
|||||||
rl.InitWindow(WINDOW_WIDTH, WINDOW_HEIGHT, WINDOW_TITLE)
|
rl.InitWindow(WINDOW_WIDTH, WINDOW_HEIGHT, WINDOW_TITLE)
|
||||||
rl.SetTargetFPS(60)
|
rl.SetTargetFPS(60)
|
||||||
|
|
||||||
// sub systems
|
// inits
|
||||||
game.assets = asset_manager_init()
|
game.assets = asset_manager_init()
|
||||||
|
game.player = player_init(&game.assets.player)
|
||||||
|
|
||||||
if DEBUG_MODE {
|
if DEBUG_MODE do rl.TraceLog(.INFO, "Game initialized")
|
||||||
rl.TraceLog(.INFO, "Game initialized")
|
|
||||||
}
|
|
||||||
|
|
||||||
return game
|
return game
|
||||||
}
|
}
|
||||||
@@ -27,9 +27,7 @@ game_should_run :: proc(game: ^Game) -> bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
game_update :: proc(game: ^Game) {
|
game_update :: proc(game: ^Game) {
|
||||||
if rl.IsMouseButtonPressed(.LEFT) {
|
update_player(&game.player, &game.assets.player)
|
||||||
log_info("Mouse Clicked")
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
game_draw :: proc(game: ^Game) {
|
game_draw :: proc(game: ^Game) {
|
||||||
@@ -38,9 +36,10 @@ game_draw :: proc(game: ^Game) {
|
|||||||
// Do Draw Calls here
|
// Do Draw Calls here
|
||||||
rl.ClearBackground(rl.DARKGRAY)
|
rl.ClearBackground(rl.DARKGRAY)
|
||||||
|
|
||||||
if DEBUG_MODE {
|
if DEBUG_MODE do rl.DrawFPS(20, 20)
|
||||||
rl.DrawFPS(20, 20)
|
|
||||||
}
|
// Renderer calls
|
||||||
|
renderer_draw_player(&game.player)
|
||||||
|
|
||||||
rl.EndDrawing()
|
rl.EndDrawing()
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user