Main Page | Namespace List | Class Hierarchy | Class List | Directories | File List | Namespace Members | Class Members | File Members

# 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
    00103                 void LoadPlugin(const String& strPluginName);
    00104
    00107         void UnloadPlugins(void);
    00108
    00111         void StopRendering(void);
    00112
    00117         void StartRendering(void);
    00118
    00122         bool RenderOneFrame(void);
    00123
    00126         void Shutdown(void);
    00127
    00130         CTimer* GetTimer(void);
    00131
    00135         bool RestoreConfig(void);
    00136
    00139         void SaveConfig(void);
    00140
    00144         bool ShowConfigDialog(void);
    00145
    00148                 const String& GetVersion()
    00149                 { return m_strVersion; }
    00150
    00151     private :
    00152
    00155         CRoot();
    00156
    00159         ~CRoot();
    00160
    00162         IRenderSystem* m_pActiveRenderSystem;
    00163
    00165         CTimer * m_pTimer;
    00166
    00168         std::vector<CDynLib*> m_PluginLibs;
    00169
    00171         bool m_bStopRendering;
    00172
    00174                 RenderSystemList m_Renderers;
    00175
    00177                 String m_strVersion;
    00178
    00179     };
    00180
    00181 } // namespace Keos
    00182
    00183 #endif // KEOS_ROOT_H