00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00029 #ifndef _GG_OgreGUI_h_
00030 #define _GG_OgreGUI_h_
00031
00032 #include <OgreDataStream.h>
00033 #include <OgreRenderTargetListener.h>
00034 #include <OgreSharedPtr.h>
00035 #include <OgreTimer.h>
00036 #include <OgreWindowEventUtilities.h>
00037
00038 #include <GG/GUI.h>
00039
00040
00041 #ifdef _MSC_VER
00042 # ifdef GIGI_OGRE_EXPORTS
00043 # define GG_OGRE_API __declspec(dllexport)
00044 # else
00045 # define GG_OGRE_API __declspec(dllimport)
00046 # endif
00047 #else
00048 # define GG_OGRE_API
00049 #endif
00050
00051 namespace Ogre {
00052 class RenderWindow;
00053 }
00054
00055 namespace GG {
00056
00092 class GG_OGRE_API OgreGUI :
00093 public GUI,
00094 public Ogre::RenderTargetListener,
00095 public Ogre::WindowEventListener
00096 {
00097 public:
00101 explicit OgreGUI(Ogre::RenderWindow* window, const std::string& config_filename = "");
00102
00104 virtual ~OgreGUI();
00105
00107 virtual boost::shared_ptr<ModalEventPump> CreateModalEventPump(bool& done);
00108
00109 virtual int Ticks() const;
00110 virtual int AppWidth() const;
00111 virtual int AppHeight() const;
00112
00116 const Ogre::SharedPtr<Ogre::DataStream>& ConfigFileStream() const;
00117
00118 virtual void Exit(int code);
00119
00122 boost::signal<void ()> HandleSystemEventsSignal;
00123
00125 boost::signal<void (int, int)> WindowResizedSignal;
00126
00129 boost::signal<void ()> WindowClosedSignal;
00130
00132 static OgreGUI* GetGUI();
00133
00134 protected:
00135 virtual void RenderBegin();
00136 virtual void RenderEnd();
00137 virtual void Run();
00138 virtual void HandleSystemEvents();
00139 virtual void Enter2DMode();
00140 virtual void Exit2DMode();
00141
00142 private:
00143 virtual void postRenderTargetUpdate(const Ogre::RenderTargetEvent& event);
00144 virtual void windowResized(Ogre::RenderWindow* window);
00145 virtual void windowClosed(Ogre::RenderWindow* window);
00146
00147 Ogre::RenderWindow* m_window;
00148 mutable Ogre::Timer m_timer;
00149 Ogre::SharedPtr<Ogre::DataStream> m_config_file_data;
00150 };
00151
00152 }
00153
00154 #endif // _GG_OgreGUI_h_