From: <he...@us...> - 2012-01-21 22:56:15
|
Revision: 287 http://simspark.svn.sourceforge.net/simspark/?rev=287&view=rev Author: hedayat Date: 2012-01-21 22:56:08 +0000 (Sat, 21 Jan 2012) Log Message: ----------- Handle window quit event Modified Paths: -------------- trunk/spark/ChangeLog trunk/spark/lib/kerosin/openglserver/openglserver.cpp trunk/spark/lib/kerosin/openglserver/openglsystem.h trunk/spark/lib/kerosin/renderserver/rendercontrol.cpp trunk/spark/plugin/openglsyssdl/openglsystemsdl.cpp trunk/spark/plugin/openglsyssdl/openglsystemsdl.h Modified: trunk/spark/ChangeLog =================================================================== --- trunk/spark/ChangeLog 2011-07-25 19:41:53 UTC (rev 286) +++ trunk/spark/ChangeLog 2012-01-21 22:56:08 UTC (rev 287) @@ -1,3 +1,16 @@ +2012-01-22 Hedayat Vatankhah <hed...@gm...> + + * lib/kerosin/renderserver/rendercontrol.cpp (RenderControl::EndCycle): + * lib/kerosin/openglserver/openglserver.cpp (OpenGLServer::Init): + - check if opengl system wants to quit + + * plugin/openglsyssdl/openglsystemsdl.h (OpenGLSystemSDL.mWantsToQuit): + * plugin/openglsyssdl/openglsystemsdl.cpp (OpenGLSystemSDL::Update): + - handle SDL_QUIT event and add WantsToQuit function + + * lib/kerosin/openglserver/openglsystem.h (OpenGLSystem): + - add WantsToQuit() function + 2011-05-02 Hedayat Vatankhah <hed...@gm...> * CMakeLists.txt: Modified: trunk/spark/lib/kerosin/openglserver/openglserver.cpp =================================================================== --- trunk/spark/lib/kerosin/openglserver/openglserver.cpp 2011-07-25 19:41:53 UTC (rev 286) +++ trunk/spark/lib/kerosin/openglserver/openglserver.cpp 2012-01-21 22:56:08 UTC (rev 287) @@ -96,6 +96,10 @@ } mGLSystem->Update(); + if (mGLSystem->WantsToQuit()) + { + mWantsToQuit = true; + } } void Modified: trunk/spark/lib/kerosin/openglserver/openglsystem.h =================================================================== --- trunk/spark/lib/kerosin/openglserver/openglsystem.h 2011-07-25 19:41:53 UTC (rev 286) +++ trunk/spark/lib/kerosin/openglserver/openglsystem.h 2012-01-21 22:56:08 UTC (rev 287) @@ -55,6 +55,9 @@ //! return if the GL subsystem locks using OpenGL to get exclusive access. virtual bool IsGLLocked() const { return false; } + //! return if the GL subsystem have received a quit event. + virtual bool WantsToQuit() const { return false; } + protected: // // members Modified: trunk/spark/lib/kerosin/renderserver/rendercontrol.cpp =================================================================== --- trunk/spark/lib/kerosin/renderserver/rendercontrol.cpp 2011-07-25 19:41:53 UTC (rev 286) +++ trunk/spark/lib/kerosin/renderserver/rendercontrol.cpp 2012-01-21 22:56:08 UTC (rev 287) @@ -21,6 +21,7 @@ #include "customrender.h" #include <zeitgeist/logserver/logserver.h> #include <oxygen/sceneserver/sceneserver.h> +#include <oxygen/simulationserver/simulationserver.h> using namespace kerosin; using namespace oxygen; @@ -87,6 +88,8 @@ // update the window (pumps event loop, etc..) and render the // current frame mOpenGLServer->Update(); + if (mOpenGLServer->WantsToQuit()) + GetSimulationServer()->Quit(); mRenderServer->Render(true); RenderCustom(); mOpenGLServer->SwapBuffers(); Modified: trunk/spark/plugin/openglsyssdl/openglsystemsdl.cpp =================================================================== --- trunk/spark/plugin/openglsyssdl/openglsystemsdl.cpp 2011-07-25 19:41:53 UTC (rev 286) +++ trunk/spark/plugin/openglsyssdl/openglsystemsdl.cpp 2012-01-21 22:56:08 UTC (rev 287) @@ -37,7 +37,7 @@ OpenGLSystemSDL *gInputSystem; -OpenGLSystemSDL::OpenGLSystemSDL() : OpenGLSystem() +OpenGLSystemSDL::OpenGLSystemSDL() : OpenGLSystem(), mWantsToQuit(false) { } @@ -54,6 +54,8 @@ // Grab all the events off the queue. while( SDL_PollEvent( &event ) ) { + if (event.type == SDL_QUIT) + mWantsToQuit = true; } } @@ -172,3 +174,8 @@ return true; } + +bool OpenGLSystemSDL::WantsToQuit() const +{ + return mWantsToQuit; +} Modified: trunk/spark/plugin/openglsyssdl/openglsystemsdl.h =================================================================== --- trunk/spark/plugin/openglsyssdl/openglsystemsdl.h 2011-07-25 19:41:53 UTC (rev 286) +++ trunk/spark/plugin/openglsyssdl/openglsystemsdl.h 2012-01-21 22:56:08 UTC (rev 287) @@ -47,6 +47,12 @@ OpenGLSystems that support double buffering */ virtual void SwapBuffers(); + + //! return if the GL subsystem have received a quit event. + virtual bool WantsToQuit() const; + +private: + bool mWantsToQuit; }; DECLARE_CLASS(OpenGLSystemSDL); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |