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