]> code.bitgloo.com Git - clyne/gamedev.git/commitdiff
esc to quit
authorClyne Sullivan <tullivan99@gmail.com>
Mon, 7 Sep 2015 15:27:05 +0000 (11:27 -0400)
committerClyne Sullivan <tullivan99@gmail.com>
Mon, 7 Sep 2015 15:27:05 +0000 (11:27 -0400)
src/main.cpp

index df9d069ba8333b22a37cadb9b809acc181fbfd0f..8b3036eef6388ea5b1f948e11e7a01facea51025 100644 (file)
@@ -46,8 +46,21 @@ int main(int argc,char **argv){
                glClear(GL_COLOR_BUFFER_BIT);
                SDL_GL_SwapWindow(window);
                while(SDL_PollEvent(&e)){
-                       if(e.type==SDL_QUIT)
+                       switch(e.type){
+                       case SDL_QUIT:
                                gameRunning=false;
+                               break;
+                       case SDL_KEYDOWN:
+                               switch(e.key.keysym.sym){
+                               case 27:
+                                       gameRunning=false;
+                                       break;
+                               default:
+                                       break;
+                               }
+                       default:
+                               break;
+                       }
                }
        }
     //closes the window and frees resources