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

# Keos::CRoot Class Reference

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

`#include <KeosRoot.h>`

Inheritance diagram for Keos::CRoot:

List of all members.

## Public Member Functions

IRenderWindow * | Initialise (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.
IRenderSystem * | GetRenderSystem ()
| Retrieve a pointer to the currently render system.
RenderSystemList * | GetAvailableRenderers (void)
| Retrieve a list of the available render systems.
void | LoadPlugin (const String &strPluginName)
| 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.
CTimer * | GetTimer (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 String & | GetVersion ()
| Return version of Keos.

## Static Public Member Functions

static void | _TermHandler (void)

## Private Member Functions

| CRoot ()
| Default constructor.
| ~CRoot ()
| Destructor.

## Private Attributes

friend | CSingleton<CRoot>
IRenderSystem * | m_pActiveRenderSystem
| The active rendering system.
CTimer * | m_pTimer
| Timer used for all KEOS timings.
std::vector< CDynLib * > | m_PluginLibs
| List of loaded plugins.
bool | m_bStopRendering
| Used to stop the loop rendering.
RenderSystemList | m_Renderers
| List of availaible RenderSystem.
String | m_strVersion
| Keos version.

## 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.

## Constructor & Destructor Documentation

Keos::CRoot::CRoot | ( |  | ) | `[private]`

| Default constructor. Definition at line 70 of file KeosRoot.cpp. References KEOS_D3D9_LIB, KEOS_LOG_FILE, KEOS_OGL_LIB, KEOS_VERSION_MAJOR, KEOS_VERSION_MINOR, KEOS_VERSION_NAME, KEOS_VERSION_PATCH, LoadPlugin(), m_pActiveRenderSystem, m_pTimer, m_strVersion, Keos::CMediaManager::RegisterLoader(), SET_TERM_HANDLER, Keos::SHADER_PIXEL, and Keos::SHADER_VERTEX.

Keos::CRoot::~CRoot | ( |  | ) | `[private]`

| Destructor. Definition at line 113 of file KeosRoot.cpp.

## Member Function Documentation

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

| Definition at line 64 of file KeosRoot.cpp. References Keos::handleTerminate().

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 342 of file KeosRoot.cpp.

References m_Renderers.

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().

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

| Retrieve a pointer to the currently render system. Definition at line 88 of file KeosRoot.h.

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

| Gets a pointer to the central timer used for all KEOS timings. Definition at line 207 of file KeosRoot.cpp. References m_pTimer.

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

| Return version of Keos. Definition at line 148 of file KeosRoot.h.

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 119 of file KeosRoot.cpp.

References Assert, Keos::IRenderSystem::Initialise(), and m_pActiveRenderSystem.

void Keos::CRoot::LoadPlugin | ( | const String & | strPluginName | ) |

| Manually load a plugin.

Parameters:

  | strPluginName | Name of the plugin library to load.

Definition at line 129 of file KeosRoot.cpp.

References DYNLIB_EXCEPT, Keos::CDynLib::GetSymbol(), and m_PluginLibs.

Referenced by CRoot().

bool Keos::CRoot::RenderOneFrame | ( | void |  | ) |

| Render one frame. Updates all the render targets automatically and then returns. Definition at line 200 of file KeosRoot.cpp. References m_pActiveRenderSystem, and Keos::IRenderSystem::UpdateAllRenderTargets(). Referenced by StartRendering().

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 233 of file KeosRoot.cpp.

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

void Keos::CRoot::SaveConfig | ( | void |  | ) |

| Save video/sound/etc settings. Definition at line 290 of file KeosRoot.cpp. References Keos::_ConfigOption::currentValue, Keos::IRenderSystem::GetConfigOptions(), Keos::IRenderSystem::GetName(), KEOS_CONFIG_FILE, m_pActiveRenderSystem, Keos::_ConfigOption::name, and Keos::CXMLConfigFile::Save().

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 325 of file KeosRoot.cpp.

References m_pActiveRenderSystem, and Keos::IRenderSystem::Shutdown().

Referenced by RestoreConfig().

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 309 of file KeosRoot.cpp.

References Keos::IConfigDialog::Display().

void Keos::CRoot::Shutdown | ( | void |  | ) |

| Shuts down the system. Definition at line 213 of file KeosRoot.cpp. References Keos::CSingleton< CRoot >::Destroy(), m_pTimer, and UnloadPlugins().

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 169 of file KeosRoot.cpp. References Assert, Keos::IRenderSystem::InitAllRenderTargets(), m_bStopRendering, m_pActiveRenderSystem, and RenderOneFrame().

void Keos::CRoot::StopRendering | ( | void |  | ) |

| If the StartRendering() has been called, the rendering loop will stop. Definition at line 163 of file KeosRoot.cpp. References m_bStopRendering.

void Keos::CRoot::UnloadPlugins | ( | void |  | ) |

| Unloads all loaded plugins. Definition at line 146 of file KeosRoot.cpp. References Keos::CDynLib::GetSymbol(), m_PluginLibs, and Keos::CDynLib::Unload(). Referenced by Shutdown().

## Member Data Documentation

friend Keos::CRoot::CSingleton<CRoot>`[private]`

| Definition at line 56 of file KeosRoot.h.

bool Keos::CRoot::m_bStopRendering`[private]`

| Used to stop the loop rendering. Definition at line 171 of file KeosRoot.h. Referenced by StartRendering(), and StopRendering().

IRenderSystem* Keos::CRoot::m_pActiveRenderSystem`[private]`

| The active rendering system. Definition at line 162 of file KeosRoot.h. Referenced by CRoot(), Initialise(), RenderOneFrame(), RestoreConfig(), SaveConfig(), SetRenderSystem(), and StartRendering().

std::vector<CDynLib*> Keos::CRoot::m_PluginLibs`[private]`

| List of loaded plugins. Definition at line 168 of file KeosRoot.h. Referenced by LoadPlugin(), and UnloadPlugins().

CTimer* Keos::CRoot::m_pTimer`[private]`

| Timer used for all KEOS timings. Definition at line 165 of file KeosRoot.h. Referenced by CRoot(), GetTimer(), and Shutdown().

RenderSystemList Keos::CRoot::m_Renderers`[private]`

| List of availaible RenderSystem. Definition at line 174 of file KeosRoot.h. Referenced by AddRenderSystem().

String Keos::CRoot::m_strVersion`[private]`

| Keos version. Definition at line 177 of file KeosRoot.h. Referenced by CRoot().

The documentation for this class was generated from the following files:

- KeosEngine/KeosRoot.h
- KeosEngine/KeosRoot.cpp