OgreGUI.h

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 /* GG is a GUI for SDL and OpenGL.
00003    Copyright (C) 2007 T. Zachary Laine
00004 
00005    This library is free software; you can redistribute it and/or
00006    modify it under the terms of the GNU Lesser General Public License
00007    as published by the Free Software Foundation; either version 2.1
00008    of the License, or (at your option) any later version.
00009    
00010    This library is distributed in the hope that it will be useful,
00011    but WITHOUT ANY WARRANTY; without even the implied warranty of
00012    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013    Lesser General Public License for more details.
00014     
00015    You should have received a copy of the GNU Lesser General Public
00016    License along with this library; if not, write to the Free
00017    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
00018    02111-1307 USA
00019 
00020    If you do not wish to comply with the terms of the LGPL please
00021    contact the author as other terms are available for a fee.
00022     
00023    Zach Laine
00024    whatwasthataddress@hotmail.com */
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 } // namespace GG
00153 
00154 #endif // _GG_OgreGUI_h_

Generated on Wed Mar 26 14:35:42 2008 for GG by  doxygen 1.5.2