Small comment cleanup and initial use of entites.
This commit is contained in:
+26
-2
@@ -15,7 +15,9 @@ State :: enum {
|
||||
}
|
||||
|
||||
Game :: struct {
|
||||
state: State
|
||||
state: State,
|
||||
player: Entity,
|
||||
enemy: Entity
|
||||
}
|
||||
|
||||
// @NOTE: procs ie: game_init, game should run etc is a convention to work with wasm
|
||||
@@ -25,20 +27,42 @@ game_init :: proc(game: ^Game) {
|
||||
rl.InitWindow(WINDOW_WIDTH, WINDOW_HEIGHT, WINDOW_TITLE)
|
||||
rl.SetTargetFPS(60)
|
||||
|
||||
game.state = .IN_GAME
|
||||
game.state = .IN_GAME
|
||||
game.player = init_player()
|
||||
}
|
||||
|
||||
game_update :: proc(game: ^Game) {
|
||||
// get delta time for frame
|
||||
dt := rl.GetFrameTime()
|
||||
|
||||
#partial switch game.state {
|
||||
case .IN_GAME: update_gameplay(dt, game)
|
||||
}
|
||||
}
|
||||
|
||||
game_render :: proc(game: ^Game) {
|
||||
rl.BeginDrawing()
|
||||
rl.ClearBackground(rl.DARKGRAY)
|
||||
|
||||
#partial switch game.state {
|
||||
case .IN_GAME: render_gameplay(game)
|
||||
}
|
||||
rl.EndDrawing()
|
||||
}
|
||||
|
||||
game_quit :: proc(game: ^Game) {
|
||||
rl.CloseWindow()
|
||||
}
|
||||
|
||||
update_gameplay :: proc(dt: f32, game: ^Game) {
|
||||
// game not paused for each component, ie player, enemies, environment
|
||||
// run update functions here.
|
||||
|
||||
update_player(dt, &game.player)
|
||||
// update_camera
|
||||
// update_entities
|
||||
}
|
||||
|
||||
render_gameplay :: proc(game: ^Game) {
|
||||
render_player(game.player)
|
||||
}
|
||||
Reference in New Issue
Block a user