]> git.jsancho.org Git - lugaru.git/commitdiff
Quick fix to Lugaru's freezing at going out of focus
authorOndřej Hošek <ondra.hosek@gmail.com>
Sun, 30 May 2010 06:10:05 +0000 (01:10 -0500)
committerOndřej Hošek <ondra.hosek@gmail.com>
Sun, 30 May 2010 06:10:05 +0000 (01:10 -0500)
Source/OpenGL_Windows.cpp

index b68c60bcfd37bc3d4e03960d401d03430aa5ddea..618ef4742d4218bfbb9ff5571775816b46fd8c7b 100644 (file)
@@ -1117,7 +1117,12 @@ int main(int argc, char **argv)
                                        }
 
                                        // game is not in focus, give CPU time to other apps by waiting for messages instead of 'peeking'
-                    STUBBED("give up CPU but sniff the event queue");
+                                       SDL_ActiveEvent evt;
+                                       SDL_WaitEvent((SDL_Event*)&evt);
+                                       if (evt.type == SDL_ACTIVEEVENT && evt.gain == 1)
+                                               gameFocused = true;
+                                       else if (evt.type == SDL_QUIT)
+                                               gDone = true;
                                }
                        }