]> git.jsancho.org Git - lugaru.git/commitdiff
Fixed #11 so that we can close the window while editing text
authorCôme Chilliet <come@chilliet.eu>
Sat, 26 Nov 2016 12:54:20 +0000 (20:54 +0800)
committerCôme Chilliet <come@chilliet.eu>
Sat, 26 Nov 2016 12:54:20 +0000 (20:54 +0800)
only small problem is that alt+enter will switch fullscreen and end
editing at the same time

Source/Game.cpp
Source/Game.h
Source/OpenGL_Windows.cpp

index ca2cb5df914734cc6a6a5ca415ee722ed625128c..5b816b54bd7349350c4637dd9c571629f64a7476 100644 (file)
@@ -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 */
index c5f37cb7310c0f2c6a53ee5c92baa941cd1e7c5a..b5a16c6bf2fec9b1e04381f8e381d3fda424ae87 100644 (file)
@@ -237,4 +237,7 @@ extern const char *wolfskin[3];
 
 extern const char **creatureskin[2];
 
+SDL_bool sdlEventProc(const SDL_Event &e);
+
+
 #endif
index de18d4a945646cd476fb0fb550f6799ced6ef663..c78dc28755817be7376ad9edb5c1d5cedeb76800 100644 (file)
@@ -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: