mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-11 00:39:59 +00:00
34 lines
654 B
C++
34 lines
654 B
C++
#ifndef OENGINE_OGRE_EXITLISTEN_H
|
|
#define OENGINE_OGRE_EXITLISTEN_H
|
|
|
|
/*
|
|
This FrameListener simply exits the rendering loop when the window
|
|
is closed. You can also tell it to exit manually by setting the exit
|
|
member to true;
|
|
*/
|
|
|
|
#include <OgreFrameListener.h>
|
|
#include <OgreRenderWindow.h>
|
|
|
|
namespace OEngine {
|
|
namespace Render
|
|
{
|
|
struct ExitListener : Ogre::FrameListener
|
|
{
|
|
Ogre::RenderWindow *window;
|
|
bool exit;
|
|
|
|
ExitListener(Ogre::RenderWindow *wnd)
|
|
: window(wnd), exit(false) {}
|
|
|
|
bool frameStarted(const FrameEvent &evt)
|
|
{
|
|
if(window->isClosed())
|
|
exit = true;
|
|
|
|
return !exit;
|
|
}
|
|
};
|
|
}}
|
|
#endif
|