X-Git-Url: https://git.jsancho.org/?a=blobdiff_plain;f=Source%2FOpenGL_Windows.cpp;h=8a9b6923c2662945978da3161d66777ea4d3c4ce;hb=52a7415ef901c641fd045cc3b8aed9d53a3241d6;hp=8cfe83618deecc6249254410a40a5c01367d4f4b;hpb=5e808c58a6397c2cb1ae08293d2ba1fc91b15a0a;p=lugaru.git diff --git a/Source/OpenGL_Windows.cpp b/Source/OpenGL_Windows.cpp index 8cfe836..8a9b692 100644 --- a/Source/OpenGL_Windows.cpp +++ b/Source/OpenGL_Windows.cpp @@ -286,29 +286,6 @@ void DrawGL (Game & game) } } - -/*static KeyMap g_theKeys; - -void SetKey( int key) -{ - g_theKeys[ key >> 3] |= (1 << (key & 7)); -} - -void ClearKey( int key) -{ - g_theKeys[ key >> 3] &= (0xff ^ (1 << (key & 7))); -} - -void GetKeys( unsigned char theKeys[16]) -{ - memcpy( theKeys, &g_theKeys, 16); -}*/ - -Boolean Button() -{ - return SDL_GetMouseState(NULL,NULL)&SDL_BUTTON(SDL_BUTTON_LEFT); -} - static inline int clamp_sdl_mouse_button(Uint8 button) { if (button == 2) // right mouse button is button 3 in SDL. @@ -899,7 +876,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; } } @@ -908,7 +890,7 @@ int main(int argc, char **argv) pgame = 0; CleanUp (); - + return 0; } catch (const std::exception& error)