From: Clyne Sullivan Date: Mon, 7 Sep 2015 15:27:05 +0000 (-0400) Subject: esc to quit X-Git-Url: https://code.bitgloo.com/?a=commitdiff_plain;h=47091d3e2d7a2460c2111725b7c344d2df9eb699;p=clyne%2Fgamedev.git esc to quit --- diff --git a/src/main.cpp b/src/main.cpp index df9d069..8b3036e 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -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