Basic audio manager setup.
This commit is contained in:
@@ -13,6 +13,7 @@ Game :: struct {
|
||||
scene: Scene,
|
||||
overlay_scene: Maybe(Scene),
|
||||
should_close: bool,
|
||||
audio: Audio_Manager,
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------
|
||||
@@ -22,6 +23,9 @@ game_init :: proc(game: ^Game) {
|
||||
rl.InitWindow(WINDOW_W, WINDOW_H, WINDOW_TITLE)
|
||||
rl.SetTargetFPS(60)
|
||||
|
||||
// init any global managers
|
||||
audio_init(&game.audio)
|
||||
|
||||
// allocate some event capacity to stop early dynamic reallocations
|
||||
GLOBAL_EVENTS = make([dynamic]Event, 0, 16)
|
||||
|
||||
@@ -43,6 +47,9 @@ game_update :: proc(game: ^Game) {
|
||||
scene_update(&game.scene, game, input, dt)
|
||||
}
|
||||
|
||||
// background music buffer streaming
|
||||
audio_update(&game.audio, dt)
|
||||
|
||||
// flush any events triggered in this loop
|
||||
flush_events()
|
||||
}
|
||||
@@ -72,6 +79,10 @@ game_render :: proc(game: ^Game) {
|
||||
game_quit :: proc(game: ^Game) {
|
||||
delete(GLOBAL_EVENTS)
|
||||
rl.UnloadRenderTexture(game.viewport)
|
||||
|
||||
// cleanup global managers
|
||||
audio_manager_quit(&game.audio)
|
||||
|
||||
rl.CloseWindow()
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user