This commit is contained in:
Glenn Maynard
2004-06-14 03:55:38 +00:00
parent 58cf9f21c5
commit c2d109dc02
@@ -15,15 +15,17 @@ LowLevelWindow_SDL::LowLevelWindow_SDL()
* of the SDL video system--it'll be reinitialized on us if we do this first. */ * of the SDL video system--it'll be reinitialized on us if we do this first. */
SDL_EventState(0xFF /*SDL_ALLEVENTS*/, SDL_IGNORE); SDL_EventState(0xFF /*SDL_ALLEVENTS*/, SDL_IGNORE);
SDL_EventState(SDL_VIDEORESIZE, SDL_ENABLE); SDL_EventState( SDL_VIDEORESIZE, SDL_ENABLE );
SDL_EventState(SDL_ACTIVEEVENT, SDL_ENABLE); SDL_EventState( SDL_ACTIVEEVENT, SDL_ENABLE );
SDL_EventState( SDL_QUIT, SDL_ENABLE );
} }
LowLevelWindow_SDL::~LowLevelWindow_SDL() LowLevelWindow_SDL::~LowLevelWindow_SDL()
{ {
SDL_QuitSubSystem(SDL_INIT_VIDEO); SDL_QuitSubSystem(SDL_INIT_VIDEO);
mySDL_EventState(SDL_VIDEORESIZE, SDL_IGNORE); mySDL_EventState( SDL_VIDEORESIZE, SDL_IGNORE );
mySDL_EventState(SDL_ACTIVEEVENT, SDL_IGNORE); mySDL_EventState( SDL_ACTIVEEVENT, SDL_IGNORE );
mySDL_EventState( SDL_QUIT, SDL_IGNORE );
} }
void *LowLevelWindow_SDL::GetProcAddress(CString s) void *LowLevelWindow_SDL::GetProcAddress(CString s)
@@ -197,10 +199,11 @@ void LowLevelWindow_SDL::SwapBuffers()
void LowLevelWindow_SDL::Update(float fDeltaTime) void LowLevelWindow_SDL::Update(float fDeltaTime)
{ {
HandleSDLEvents(); /* This needs to be called before anything that handles SDL events. */
SDL_PumpEvents();
SDL_Event event; SDL_Event event;
while(SDL_GetEvent(event, SDL_VIDEORESIZEMASK|SDL_ACTIVEEVENTMASK)) while(SDL_GetEvent(event, SDL_VIDEORESIZEMASK|SDL_ACTIVEEVENTMASK|SDL_QUITMASK))
{ {
switch(event.type) switch(event.type)
{ {
@@ -233,6 +236,10 @@ void LowLevelWindow_SDL::Update(float fDeltaTime)
FocusChanged( i&SDL_APPINPUTFOCUS && i&SDL_APPACTIVE ); FocusChanged( i&SDL_APPINPUTFOCUS && i&SDL_APPACTIVE );
} }
break; break;
case SDL_QUIT:
LOG->Trace("SDL_QUIT: shutting down");
ExitGame();
break;
} }
} }
} }