From 47a277ce2b194f471809e7268eef109bb9e7e18a Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Mon, 14 Jun 2004 03:11:39 +0000 Subject: [PATCH] move HandleSDLEvents to SDL_utils; the renderer is now responsible for calling this --- stepmania/src/SDL_utils.cpp | 21 +++++++++++++++++++++ stepmania/src/SDL_utils.h | 2 ++ 2 files changed, 23 insertions(+) diff --git a/stepmania/src/SDL_utils.cpp b/stepmania/src/SDL_utils.cpp index c1ccfe216c..855604f8bc 100644 --- a/stepmania/src/SDL_utils.cpp +++ b/stepmania/src/SDL_utils.cpp @@ -9,6 +9,8 @@ #include "RageUtil.h" #include "RageSurface.h" #include "RageSurfaceUtils.h" +#include "StepMania.h" + #include /* Pull in all of our SDL libraries here. */ @@ -320,6 +322,25 @@ RageSurface *RageSurfaceFromSDLSurface( SDL_Surface *surf ) return ret; } +void HandleSDLEvents() +{ + /* This needs to be called before anything that handles SDL events. */ + SDL_PumpEvents(); + + // process all queued events + SDL_Event event; + while(SDL_GetEvent(event, SDL_QUITMASK)) + { + switch(event.type) + { + case SDL_QUIT: + LOG->Trace("SDL_QUIT: shutting down"); + ExitGame(); + break; + } + } +} + /* * (c) 2002-2004 Glenn Maynard * All rights reserved. diff --git a/stepmania/src/SDL_utils.h b/stepmania/src/SDL_utils.h index f1f64e076e..ca1b50c3f2 100644 --- a/stepmania/src/SDL_utils.h +++ b/stepmania/src/SDL_utils.h @@ -31,6 +31,8 @@ void mySDL_WM_SetIcon( CString sIconFile ); SDL_Surface *SDLSurfaceFromRageSurface( RageSurface *surf ); RageSurface *RageSurfaceFromSDLSurface( SDL_Surface *surf ); +void HandleSDLEvents(); + #endif /*