From ad46a578f2879eef5c1ee922ab22922e1f7988f2 Mon Sep 17 00:00:00 2001 From: =?utf8?q?C=C3=B4me=20Chilliet?= Date: Sat, 26 Nov 2016 20:54:20 +0800 Subject: [PATCH] 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 --- Source/Game.cpp | 4 ++++ Source/Game.h | 3 +++ Source/OpenGL_Windows.cpp | 2 +- 3 files changed, 8 insertions(+), 1 deletion(-) 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: -- 2.39.5