summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Scheibenpflug <zorchenhimer@gmail.com>2015-03-18 02:50:42 (GMT)
committerNick Scheibenpflug <zorchenhimer@gmail.com>2015-03-18 02:50:42 (GMT)
commit93a73ed671d6dae2e085bf2436881e0d43466132 (patch)
tree1741f5a9f2b3b8f83731fa3b0a732eb0e59c2939
parentc0579f33df4edcf09546f40b5dbfa198e8a2a259 (diff)
downloadspace-zap-93a73ed671d6dae2e085bf2436881e0d43466132.zip
space-zap-93a73ed671d6dae2e085bf2436881e0d43466132.tar.gz
Added missing SDL_QUIT event handler.
-rw-r--r--main.cpp9
-rw-r--r--main.h2
2 files changed, 6 insertions, 5 deletions
diff --git a/main.cpp b/main.cpp
index d635950..124618d 100644
--- a/main.cpp
+++ b/main.cpp
@@ -12,14 +12,15 @@ int main(int argc, char* argv[]) {
12 12
13 Running = true; 13 Running = true;
14 14
15 input->RegisterHandle(SDLK_ESCAPE, &exit); 15 input->RegisterHandle(SDLK_ESCAPE, &exit_spacezap);
16 16
17 while(Running) { 17 while(Running) {
18 SDL_Event evnt; 18 SDL_Event evnt;
19 while(SDL_PollEvent(&evnt)) { 19 while(SDL_PollEvent(&evnt)) {
20 if(evnt.type == SDL_KEYDOWN) { 20 if(evnt.type == SDL_KEYDOWN)
21 input->DoCallback(evnt.key.keysym.sym); 21 input->DoCallback(evnt.key.keysym.sym);
22 } 22 else if(evnt.type == SDL_QUIT)
23 exit_spacezap();
23 } 24 }
24 25
25 currentLevel->update(); 26 currentLevel->update();
@@ -33,6 +34,6 @@ int main(int argc, char* argv[]) {
33 return 0; 34 return 0;
34} 35}
35 36
36void exit() { 37void exit_spacezap() {
37 Running = false; 38 Running = false;
38} \ No newline at end of file 39} \ No newline at end of file
diff --git a/main.h b/main.h
index b82a08b..ed6d1a9 100644
--- a/main.h
+++ b/main.h
@@ -10,7 +10,7 @@ char* WorkingDir;
10SDL_Surface* VideoSurface; 10SDL_Surface* VideoSurface;
11bool Running; 11bool Running;
12 12
13void exit(); 13void exit_spacezap();
14 14
15#include <SDL.h> 15#include <SDL.h>
16#include <SDL_image.h> 16#include <SDL_image.h>