From: Côme Chilliet Date: Sat, 26 Nov 2016 12:54:20 +0000 (+0800) Subject: Fixed #11 so that we can close the window while editing text X-Git-Url: https://git.jsancho.org/?a=commitdiff_plain;h=ad46a578f2879eef5c1ee922ab22922e1f7988f2;p=lugaru.git Fixed #11 so that we can close the window while editing text only small problem is that alt+enter will switch fullscreen and end editing at the same time --- diff --git a/Source/Game.cpp b/Source/Game.cpp index ca2cb5d..5b816b5 100644 --- a/Source/Game.cpp +++ b/Source/Game.cpp @@ -166,6 +166,10 @@ void Game::inputText(string& str, unsigned* charselected) } while (SDL_PollEvent(&evenement)) { + if (!sdlEventProc(evenement)) { + tryquit = 1; + break; + } switch (evenement.type) { case SDL_TEXTEDITING: /* FIXME - We should handle this for complete input method support */ diff --git a/Source/Game.h b/Source/Game.h index c5f37cb..b5a16c6 100644 --- a/Source/Game.h +++ b/Source/Game.h @@ -237,4 +237,7 @@ extern const char *wolfskin[3]; extern const char **creatureskin[2]; +SDL_bool sdlEventProc(const SDL_Event &e); + + #endif diff --git a/Source/OpenGL_Windows.cpp b/Source/OpenGL_Windows.cpp index de18d4a..c78dc28 100644 --- a/Source/OpenGL_Windows.cpp +++ b/Source/OpenGL_Windows.cpp @@ -202,7 +202,7 @@ void toggleFullscreen() SDL_SetWindowFullscreen(sdlwindow, flags); } -static SDL_bool sdlEventProc(const SDL_Event &e) +SDL_bool sdlEventProc(const SDL_Event &e) { switch (e.type) { case SDL_QUIT: