aboutsummaryrefslogtreecommitdiffstats
path: root/main.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'main.cpp')
-rw-r--r--main.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/main.cpp b/main.cpp
index f1ede46..422a329 100644
--- a/main.cpp
+++ b/main.cpp
@@ -256,9 +256,11 @@ int main(int argc, char *argv[]){
if(Mix_OpenAudio( 44100, MIX_DEFAULT_FORMAT, 2, 2048) < 0){
std::cout << "SDL_mixer could not initialize! Error: " << Mix_GetError() << std::endl;
+ return -1;
}
// Run Mix_Quit when main returns
+ atexit(Mix_CloseAudio);
atexit(Mix_Quit);
/*
@@ -439,6 +441,7 @@ int main(int argc, char *argv[]){
/**************************
**** GAMELOOP ****
**************************/
+
gameRunning=true;
while(gameRunning){
mainLoop();
@@ -452,6 +455,11 @@ int main(int argc, char *argv[]){
* Close the window and free resources
*/
+ Mix_HaltMusic();
+ Mix_FreeMusic(music);
+
+ Mix_FreeChunk(horn);
+
fclose(names);
SDL_GL_DeleteContext(mainGLContext);