KeosRoot.h

Go to the documentation of this file.
00001 /*
00002  * This source file is part of KEOS (Free 3D Engine)
00003  * For the latest info, see http://www.keosengine.org/
00004  * E-mails : thierry.vouriot@keosengine.org, yeri@keosengine.org
00005  *
00006  * This program is free software; you can redistribute it and/or modify it under
00007  * the terms of the GNU Lesser General Public License as published by the Free Software
00008  * Foundation; either version 2 of the License, or (at your option) any later
00009  * version.
00010  *
00011  * This program is distributed in the hope that it will be useful, but WITHOUT
00012  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
00013  * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
00014  *
00015  * You should have received a copy of the GNU Lesser General Public License along with
00016  * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
00017  * Place - Suite 330, Boston, MA 02111-1307, USA, or go to
00018  * http://www.gnu.org/copyleft/lesser.txt.
00019  *
00020  */
00021 
00022 #ifndef KEOS_ROOT_H
00023 #define KEOS_ROOT_H
00024 
00025 #include "KeosPrerequisites.h"
00026 #include "KeosSingleton.h"
00027 #include "KeosConfigOption.h"
00028 
00029 #if KEOS_COMPILER == KEOS_COMPILER_MSVC
00030 #   define SET_TERM_HANDLER { set_terminate( &Keos::CRoot::_TermHandler ); }
00031 #else
00032 #   define SET_TERM_HANDLER { std::set_terminate( &Keos::CRoot::_TermHandler ); }
00033 #endif
00034 
00035 namespace Keos
00036 {
00037   typedef void (*DLL_START_PLUGIN)(void);
00038   typedef void (*DLL_STOP_PLUGIN)(void);
00039 
00040   typedef std::vector<IRenderSystem*> RenderSystemList;
00041 
00042   //-----------------------------------------------------------------------
00054   class KEOS_EXPORT CRoot : public CSingleton<CRoot>
00055   {
00056     friend CSingleton<CRoot>;
00057 
00058   public :
00059 
00060     static void _TermHandler(void);
00061 
00072     IRenderWindow* Initialise(bool bAutoCreateWindow, const String& strWindowTitle = "KEOS Render Window");
00073 
00079     void SetRenderSystem(IRenderSystem* pRenderSystem);
00080 
00084     void AddRenderSystem(IRenderSystem *pNewRend);
00085 
00088     IRenderSystem* GetRenderSystem()
00089     {
00090       return m_pActiveRenderSystem;
00091     }
00092 
00095     RenderSystemList* GetAvailableRenderers(void)
00096     {
00097       return &m_Renderers;
00098     }
00099 
00104     void LoadPlugin(const String& strPluginName, bool bException = true);
00105 
00108     void UnloadPlugins(void);
00109 
00112     void StopRendering(void);
00113 
00118     void StartRendering(void);
00119 
00123     bool RenderOneFrame(void);
00124 
00127     void Shutdown(void);
00128 
00131     CTimer* GetTimer(void);
00132 
00136     bool RestoreConfig(void);
00137 
00140     void SaveConfig(void);
00141 
00145     bool ShowConfigDialog(void);
00146 
00149     const String& GetVersion()
00150     {
00151       return m_strVersion;
00152     }
00153 
00154   private :
00155 
00158     CRoot();
00159 
00162     ~CRoot();
00163 
00165     IRenderSystem* m_pActiveRenderSystem;
00166 
00168     CTimer * m_pTimer;
00169 
00171     std::vector<CDynLib*> m_PluginLibs;
00172 
00174     bool m_bStopRendering;
00175 
00177     RenderSystemList m_Renderers;
00178 
00180     String m_strVersion;
00181 
00182   };
00183 
00184 } // namespace Keos
00185 
00186 #endif // KEOS_ROOT_H

Generated on Fri Mar 9 14:29:03 2007 for Keos by  doxygen 1.5.1-p1