OgreGUI.h
Go to the documentation of this file.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 #ifdef __APPLE__
00033
00034
00035 #undef TCP_NODELAY
00036 #undef TCP_MAXSEG
00037 #undef TCP_NOTIFY_THRESHOLD
00038 #undef TCP_ABORT_THRESHOLD
00039 #undef TCP_CONN_NOTIFY_THRESHOLD
00040 #undef TCP_CONN_ABORT_THRESHOLD
00041 #undef TCP_OOBINLINE
00042 #undef TCP_URGENT_PTR_TYPE
00043 #undef TCP_KEEPALIVE
00044 #include <Carbon/Carbon.h>
00045 #endif
00046
00047 #include <OgreDataStream.h>
00048 #include <OgreRenderTargetListener.h>
00049 #include <OgreSharedPtr.h>
00050 #include <OgreTimer.h>
00051 #include <OgreWindowEventUtilities.h>
00052
00053 #include <GG/GUI.h>
00054
00055
00056 #ifdef _MSC_VER
00057 # ifdef GiGiOgre_EXPORTS
00058 # define GG_OGRE_API __declspec(dllexport)
00059 # else
00060 # define GG_OGRE_API __declspec(dllimport)
00061 # endif
00062 #else
00063 # define GG_OGRE_API
00064 #endif
00065
00066 namespace Ogre {
00067 class RenderWindow;
00068 }
00069
00070 namespace GG {
00071
00123 class GG_OGRE_API OgreGUI :
00124 public GUI,
00125 public Ogre::RenderTargetListener,
00126 public Ogre::WindowEventListener
00127 {
00128 public:
00132 explicit OgreGUI(Ogre::RenderWindow* window, const std::string& config_filename = "");
00133
00135 virtual ~OgreGUI();
00136
00138 virtual boost::shared_ptr<ModalEventPump> CreateModalEventPump(bool& done);
00139
00140 virtual unsigned int Ticks() const;
00141 virtual X AppWidth() const;
00142 virtual Y AppHeight() const;
00143
00147 const Ogre::SharedPtr<Ogre::DataStream>& ConfigFileStream() const;
00148
00149 virtual void Exit(int code);
00150
00153 boost::signal<void ()> HandleSystemEventsSignal;
00154
00156 boost::signal<void (X, Y)> WindowResizedSignal;
00157
00160 boost::signal<void ()> WindowClosedSignal;
00161
00163 static OgreGUI* GetGUI();
00164
00165 protected:
00166 virtual void RenderBegin();
00167 virtual void RenderEnd();
00168 virtual void Run();
00169 virtual void HandleSystemEvents();
00170 virtual void Enter2DMode();
00171 virtual void Exit2DMode();
00172
00173 private:
00174 virtual void postRenderTargetUpdate(const Ogre::RenderTargetEvent& event);
00175 virtual void windowResized(Ogre::RenderWindow* window);
00176 virtual void windowClosed(Ogre::RenderWindow* window);
00177
00178 Ogre::RenderWindow* m_window;
00179 mutable Ogre::Timer m_timer;
00180 Ogre::SharedPtr<Ogre::DataStream> m_config_file_data;
00181 };
00182
00183 }
00184
00185 #endif // _GG_OgreGUI_h_