Keos::CRoot Class Reference

The root class of the Keos system. More...

#include <KeosRoot.h>

Inheritance diagram for Keos::CRoot:

Inheritance graph
[legend]
List of all members.

Public Member Functions

IRenderWindowInitialise (bool bAutoCreateWindow, const String &strWindowTitle="KEOS Render Window")
 Initialises the renderer.
void SetRenderSystem (IRenderSystem *pRenderSystem)
 Sets the rendering subsystem to be used.
void AddRenderSystem (IRenderSystem *pNewRend)
 Adds a new rendering subsystem to the list of available renderers.
IRenderSystemGetRenderSystem ()
 Retrieve a pointer to the currently render system.
RenderSystemListGetAvailableRenderers (void)
 Retrieve a list of the available render systems.
void LoadPlugin (const String &strPluginName, bool bException=true)
 Manually load a plugin.
void UnloadPlugins (void)
 Unloads all loaded plugins.
void StopRendering (void)
 If the StartRendering() has been called, the rendering loop will stop.
void StartRendering (void)
 Starts / restarts the automatic rendering cycle.
bool RenderOneFrame (void)
 Render one frame.
void Shutdown (void)
 Shuts down the system.
CTimerGetTimer (void)
 Gets a pointer to the central timer used for all KEOS timings.
bool RestoreConfig (void)
 Checks for saved video/sound/etc settings.
void SaveConfig (void)
 Save video/sound/etc settings.
bool ShowConfigDialog (void)
 Displays a dialog asking the user to choose system settings.
const StringGetVersion ()
 Return version of Keos.

Static Public Member Functions

static void _TermHandler (void)

Detailed Description

The root class of the Keos system.

The Keos::CRoot class represents a starting point for the client application. From here, the application can gain access to the fundamentals of the system, namely the rendering systems available, management of saved configurations, logging, and access to other classes in the system. Acts as a hub from which all other objects may be reached. An instance of Root must be created before any other Keos operations are called. Once an instance has been created, the same instance is accessible throughout the life of that object by using CRoot::Instance.

Definition at line 54 of file KeosRoot.h.


Member Function Documentation

void Keos::CRoot::_TermHandler ( void   )  [static]

Definition at line 68 of file KeosRoot.cpp.

References Keos::handleTerminate().

IRenderWindow * Keos::CRoot::Initialise ( bool  bAutoCreateWindow,
const String strWindowTitle = "KEOS Render Window" 
)

Initialises the renderer.

Parameters:
bAutoCreateWindow If true, a rendering window will automatically be created (saving a call to RenderSystem::createRenderWindow).
strWindowTitle Window's title.
Returns:
A pointer to the automatically created window, if requested, otherwise NULL.

Definition at line 124 of file KeosRoot.cpp.

References Assert, Keos::IRenderSystem::Initialise(), and Keos::ILogger::Log().

void Keos::CRoot::SetRenderSystem ( IRenderSystem pRenderSystem  ) 

Sets the rendering subsystem to be used.

This method indicates to Keos which rendering system is to be used (e.g. Direct3D, OpenGL etc).

Parameters:
pRenderSystem Pointer to the render system to use.

Definition at line 339 of file KeosRoot.cpp.

References Keos::IRenderSystem::Shutdown().

Referenced by RestoreConfig().

void Keos::CRoot::AddRenderSystem ( IRenderSystem pNewRend  ) 

Adds a new rendering subsystem to the list of available renderers.

Parameters:
pNewRend Pointer to the new render system.

Definition at line 356 of file KeosRoot.cpp.

IRenderSystem* Keos::CRoot::GetRenderSystem (  )  [inline]

Retrieve a pointer to the currently render system.

Definition at line 88 of file KeosRoot.h.

RenderSystemList* Keos::CRoot::GetAvailableRenderers ( void   )  [inline]

Retrieve a list of the available render systems.

Definition at line 95 of file KeosRoot.h.

Referenced by RestoreConfig().

void Keos::CRoot::LoadPlugin ( const String strPluginName,
bool  bException = true 
)

Manually load a plugin.

Parameters:
strPluginName Name of the plugin library to load.
bException If true, the function throw an exception if it can manage to load library.

Definition at line 134 of file KeosRoot.cpp.

References DYNLIB_EXCEPT, Keos::CDynLib::GetSymbol(), and Keos::CSingleton< T >::Instance().

void Keos::CRoot::UnloadPlugins ( void   ) 

Unloads all loaded plugins.

Definition at line 160 of file KeosRoot.cpp.

References Keos::CSingleton< T >::Instance().

Referenced by Shutdown().

void Keos::CRoot::StopRendering ( void   ) 

If the StartRendering() has been called, the rendering loop will stop.

Definition at line 177 of file KeosRoot.cpp.

void Keos::CRoot::StartRendering ( void   ) 

Starts / restarts the automatic rendering cycle.

This method begins the automatic rendering of the scene. It will NOT return until the rendering cycle is halted.

Definition at line 183 of file KeosRoot.cpp.

References Assert, Keos::IRenderSystem::InitAllRenderTargets(), and RenderOneFrame().

bool Keos::CRoot::RenderOneFrame ( void   ) 

Render one frame.

Updates all the render targets automatically and then returns.

Definition at line 214 of file KeosRoot.cpp.

References Keos::IRenderSystem::UpdateAllRenderTargets().

Referenced by StartRendering().

void Keos::CRoot::Shutdown ( void   ) 

Shuts down the system.

Definition at line 227 of file KeosRoot.cpp.

References Keos::CSingleton< T >::Destroy(), Keos::CSingleton< T >::Instance(), Keos::ILogger::Log(), and UnloadPlugins().

CTimer * Keos::CRoot::GetTimer ( void   ) 

Gets a pointer to the central timer used for all KEOS timings.

Definition at line 221 of file KeosRoot.cpp.

bool Keos::CRoot::RestoreConfig ( void   ) 

Checks for saved video/sound/etc settings.

Returns:
If a valid configuration was found, true is returned.

Definition at line 247 of file KeosRoot.cpp.

References GetAvailableRenderers(), Keos::CXMLConfigFile::GetSetting(), Keos::CXMLConfigFile::GetSettingsMap(), KEOS_CONFIG_FILE, Keos::CXMLConfigFile::Load(), Keos::ILogger::Log(), Keos::IRenderSystem::SetConfigOption(), and SetRenderSystem().

void Keos::CRoot::SaveConfig ( void   ) 

Save video/sound/etc settings.

Definition at line 304 of file KeosRoot.cpp.

References Keos::_ConfigOption::currentValue, Keos::IRenderSystem::GetConfigOptions(), Keos::IRenderSystem::GetName(), KEOS_CONFIG_FILE, Keos::ILogger::Log(), Keos::_ConfigOption::name, and Keos::CXMLConfigFile::Save().

bool Keos::CRoot::ShowConfigDialog ( void   ) 

Displays a dialog asking the user to choose system settings.

Returns:
If the user clicked 'Ok', true is returned.

Definition at line 323 of file KeosRoot.cpp.

References Keos::IConfigDialog::Display(), and Keos::CSingleton< T >::Instance().

const String& Keos::CRoot::GetVersion (  )  [inline]

Return version of Keos.

Definition at line 149 of file KeosRoot.h.


The documentation for this class was generated from the following files:
Generated on Fri Mar 9 14:29:28 2007 for Keos by  doxygen 1.5.1-p1