add quit channel to clean up after self

This commit is contained in:
2025-01-18 22:27:22 +01:00
parent fb018e2a7d
commit d86cbe15a3
3 changed files with 80 additions and 65 deletions

View File

@ -52,7 +52,7 @@ func main() {
game.Player.Model = game.Models[modelIndex].Model
game.Player.Texture = game.Models[modelIndex].Texture
go network.HandleServerCommunication(conn, playerID, game.Player, game.OtherPlayers)
go network.HandleServerCommunication(conn, playerID, game.Player, game.OtherPlayers, game.QuitChan)
rl.PlayMusicStream(game.Music)
rl.SetMusicVolume(game.Music, 0.5)
@ -65,4 +65,7 @@ func main() {
game.Update(deltaTime)
game.Render()
}
// Wait for clean shutdown
<-game.QuitChan
}