Commits

Javier Aravena  committed 3a16ba3

Ahora también se sale con q y esc.

  • Participants
  • Parent commits 2fea42a

Comments (0)

Files changed (2)

     private:
         bool Running;
         SDL_Surface * Surf_Display;
+
+        void OnKeyEvent(SDL_keysym * keysym);
     public:
         CApp();
         int OnExecute();

File CApp_OnEvent.cpp

 
 void CApp::OnEvent(SDL_Event * event)
 {
-    switch(event->type) {
+    switch(event -> type) {
         case SDL_QUIT:
             Running = false;
+            break;
+        case SDL_KEYDOWN:
+            OnKeyEvent(&(event->key.keysym));
+            break;
     }
 
 }
+
+void CApp::OnKeyEvent(SDL_keysym * keysym) {
+    switch(keysym -> sym) {
+        case SDLK_q:
+        case SDLK_ESCAPE:
+            Running = false;
+            break;
+        default:
+            break;
+    }
+}
+