Game Class Reference
[Engine Module]

#include <game.h>

Inheritance diagram for Game:

RootServer< Game > Root Server< Game > Object TreeNode< Root > Referenced Counted Serialized List< Root > ListNode< Root >

List of all members.


Detailed Description

Opens application window a perform main game loop.

Public Member Functions

 Game (const char *id)
virtual ~Game ()
bool Open ()
bool Run ()
void Close ()
bool IsRun () const
void Quit ()
void SaveScreenshot ()
void SetTitle (const string &title)
const string & GetTitle () const
FontGetSystemFont () const
OnScreenTextGetOnScreenText () const
SelectionGetSelection () const
bool ActivateProfile (const string &id)
bool ActivateGui (const string &id)
bool ActivateLevel (const string &id)
ProfileGetActiveProfile () const
GuiGetActiveGui () const
LevelGetActiveLevel () const
MapGetActiveMap () const
PlayerGetActivePlayer () const
ProfileGetProfile (const string &id) const
GuiGetGui (const string &id) const
LevelGetLevel (const string &id) const
MapGetMap (const string &id) const
SchemeGetScheme (const string &id) const
RaceGetRace (const string &id) const
bool SetUnitSelRenderer (const string &class_name)
bool SetBuildingSelRenderer (const string &class_name)
SelectionRendererGetUnitSelRenderer () const
SelectionRendererGetBuildingSelRenderer () const

Protected Member Functions

PreloadedNewPreloaded (const char *class_name, Root *root, const string &file_name)
bool LoadProfiles ()
bool ActivateProfile (Profile *profile)
void CreateDefaultProfile ()
bool ActivateLastProfile ()
bool LoadGuis ()
bool ActivateGui (Gui *gui)
bool LoadLevels ()
bool ActivateLevel (Level *level)
bool LoadMaps ()
bool LoadSchemes ()
bool LoadRaces ()
SelectionRendererNewSelRenderer (const string &class_name)

Static Protected Member Functions

static void OnSize (ushort_t width, ushort_t height, bool fullscreen)
static bool OnKey (KeyCode code, KeyState state)
static bool OnAction (const string &action, int position, void *data)
static void OnLog (LogServer::LogLevel level, const string &file_name, int line, const string &text)

Protected Attributes

string title
 Game title.
bool opened
 Whether game is opened.
bool run
 Whether game is running.
Ref< FileServerfile_server
 Pointer to file server.
Ref< SerializeServerserialize_server
 Pointer to serialize server.
Ref< GfxServergfx_server
 Pointer to gfx server.
Ref< SceneServerscene_server
 Pointer to scene server.
Ref< TimeServertime_server
 Pointer to time server.
Ref< MessageServermessage_server
 Pointer to message server.
Ref< InputServerinput_server
 Pointer to input server.
Ref< PathServerpath_server
 Pointer to path server.
Ref< AudioServeraudio_server
 Pointer to audio server.
Ref< RemoteServerremote_server
 Pointer to remote server.
Ref< Rootvariables
 Root node of all system variables.
Ref< Rootprofiles
 Root node of all profiles.
Ref< Rootguis
 Root node of all GUIs.
Ref< Rootmaps
 Root node of all maps.
Ref< Rootschemes
 Root node of all schemes.
Ref< Rootraces
 Root node of all races.
Ref< Rootlevels
 Root node of all levels.
Ref< Rootsel_renderers
 Root node of all selection renderers. In fact, there will be only two renderers: for units and for buildings.
Ref< Fontsystem_font
 System font.
Ref< Profileactive_profile
 Active profile.
Ref< Guiactive_gui
 Active GUI.
Ref< Levelactive_level
 Active level.
Ref< Mapactive_map
 Map of active level.
Ref< Playeractive_player
 Active player.
Ref< SelectionRendererunit_sel_renderer
 Active selection renderer for units.
Ref< SelectionRendererbuilding_sel_renderer
 Active selection renderer for buildings;.
MouseInfo mouse_info
Ref< OnScreenTextost
 Pointer to on-screen-text object.
Ref< Selectionselection
 Pointer to selection object.

Private Member Functions

void Update ()
void Render ()
void UpdateOstDimensions ()

Constructor & Destructor Documentation

Game::Game ( const char *  id  ) 

File server is required to be created before.

Game::~Game (  )  [virtual]

Empty.


Member Function Documentation

bool Game::Open (  ) 

Opens game. Methods loads game settings, runs setup script and opens application window. Setup script is not mandatory, it can be presented on scripts:setup_game.lua path.

Returns:
True if successful.

bool Game::Run (  ) 

Runs game. Method starts time server and provides main game loop. In this loop whole game is drawn and all servers are triggered.

Returns:
True if successful.

void Game::Close (  ) 

Closes game. Saves active profile and closes audio device.

bool Game::IsRun (  )  const [inline]

Returns running state.

Returns:
Whether game is running.

void Game::Quit (  ) 

Closes the game.

void Game::SaveScreenshot (  ) 

void Game::SetTitle ( const string &  title  ) 

Sets game title.

Parameters:
title Game title.

const string & Game::GetTitle (  )  const [inline]

Returns game title.

Returns:
Game title.

Font * Game::GetSystemFont (  )  const [inline]

OnScreenText * Game::GetOnScreenText (  )  const [inline]

Selection * Game::GetSelection (  )  const [inline]

bool Game::ActivateProfile ( const string &  id  ) 

Activates given profile.

Parameters:
id Profile identifier.
Returns:
True if successful.

bool Game::ActivateGui ( const string &  id  ) 

Activates given GUI.

Parameters:
id GUI identifier.
Returns:
True if successful.

bool Game::ActivateLevel ( const string &  id  ) 

Activates given level.

Parameters:
id Level identifier.
Returns:
True if successful.

Profile * Game::GetActiveProfile (  )  const [inline]

Gui * Game::GetActiveGui (  )  const [inline]

Level * Game::GetActiveLevel (  )  const [inline]

Map * Game::GetActiveMap (  )  const [inline]

Player * Game::GetActivePlayer (  )  const [inline]

Profile * Game::GetProfile ( const string &  id  )  const [inline]

Gui * Game::GetGui ( const string &  id  )  const [inline]

Level * Game::GetLevel ( const string &  id  )  const [inline]

Map * Game::GetMap ( const string &  id  )  const [inline]

Scheme * Game::GetScheme ( const string &  id  )  const [inline]

Race * Game::GetRace ( const string &  id  )  const [inline]

bool Game::SetUnitSelRenderer ( const string &  class_name  ) 

bool Game::SetBuildingSelRenderer ( const string &  class_name  ) 

SelectionRenderer * Game::GetUnitSelRenderer (  )  const [inline]

SelectionRenderer * Game::GetBuildingSelRenderer (  )  const [inline]

Preloaded * Game::NewPreloaded ( const char *  class_name,
Root root,
const string &  file_name 
) [protected]

Creates a Preloaded object and stores it in given path.

Returns:
Pointer to new Preloaded object.

bool Game::LoadProfiles (  )  [protected]

Creates all profiles from "profiles:" directory. If there is no profile or some error occures, the default one is created. Old profiles are released first. Last active profile is loaded and activated.

bool Game::ActivateProfile ( Profile profile  )  [protected]

Activates given profile.

Parameters:
profile Pointer to profile.
Returns:
True if successful.

void Game::CreateDefaultProfile (  )  [protected]

bool Game::ActivateLastProfile (  )  [protected]

Re-activates first profile with true active flag.

Returns:
True if successful.

bool Game::LoadGuis (  )  [protected]

Creates all GUIs from "guis:" directory. Old GUIs are released first. No GUI is loaded.

bool Game::ActivateGui ( Gui gui  )  [protected]

Activates given gui.

Parameters:
gui Pointer to GUI.
Returns:
True if successful.

Todo:
Apply new GUI here (dialogs, menu, ...).

bool Game::LoadLevels (  )  [protected]

Creates all levels from "levels:" directory. Old levels are released first. No level is loaded.

bool Game::ActivateLevel ( Level level  )  [protected]

Activates given level.

Parameters:
level Pointer to level.
Returns:
True if successful.

bool Game::LoadMaps (  )  [protected]

Creates all maps from "maps:" directory. Old maps are released first. No map is loaded.

bool Game::LoadSchemes (  )  [protected]

Creates all schemes from "schemes:" directory. Old schemes are released first. No scheme is loaded.

bool Game::LoadRaces (  )  [protected]

Creates all races from "races:" directory. Old races are released first. No race is loaded.

SelectionRenderer * Game::NewSelRenderer ( const string &  class_name  )  [protected]

void Game::OnSize ( ushort_t  width,
ushort_t  height,
bool  fullscreen 
) [static, protected]

bool Game::OnKey ( KeyCode  code,
KeyState  state 
) [static, protected]

bool Game::OnAction ( const string &  action,
int  position,
void *  data 
) [static, protected]

void Game::OnLog ( LogServer::LogLevel  level,
const string &  file_name,
int  line,
const string &  text 
) [static, protected]

void Game::Update (  )  [inline, private]

void Game::Render (  )  [inline, private]

Todo:
Draw GUI.

void Game::UpdateOstDimensions (  )  [inline, private]


Member Data Documentation

string Game::title [protected]

Game title.

bool Game::opened [protected]

Whether game is opened.

bool Game::run [protected]

Whether game is running.

Ref<FileServer> Game::file_server [protected]

Pointer to file server.

Ref<SerializeServer> Game::serialize_server [protected]

Pointer to serialize server.

Ref<GfxServer> Game::gfx_server [protected]

Pointer to gfx server.

Ref<SceneServer> Game::scene_server [protected]

Pointer to scene server.

Ref<TimeServer> Game::time_server [protected]

Pointer to time server.

Ref<MessageServer> Game::message_server [protected]

Pointer to message server.

Ref<InputServer> Game::input_server [protected]

Pointer to input server.

Ref<PathServer> Game::path_server [protected]

Pointer to path server.

Ref<AudioServer> Game::audio_server [protected]

Pointer to audio server.

Ref<RemoteServer> Game::remote_server [protected]

Pointer to remote server.

Ref<Root> Game::variables [protected]

Root node of all system variables.

Ref<Root> Game::profiles [protected]

Root node of all profiles.

Ref<Root> Game::guis [protected]

Root node of all GUIs.

Ref<Root> Game::maps [protected]

Root node of all maps.

Ref<Root> Game::schemes [protected]

Root node of all schemes.

Ref<Root> Game::races [protected]

Root node of all races.

Ref<Root> Game::levels [protected]

Root node of all levels.

Ref<Root> Game::sel_renderers [protected]

Root node of all selection renderers. In fact, there will be only two renderers: for units and for buildings.

Ref<Font> Game::system_font [protected]

System font.

Ref<Profile> Game::active_profile [protected]

Active profile.

Ref<Gui> Game::active_gui [protected]

Active GUI.

Ref<Level> Game::active_level [protected]

Active level.

Ref<Map> Game::active_map [protected]

Map of active level.

Ref<Player> Game::active_player [protected]

Active player.

Ref<SelectionRenderer> Game::unit_sel_renderer [protected]

Active selection renderer for units.

Ref<SelectionRenderer> Game::building_sel_renderer [protected]

Active selection renderer for buildings;.

MouseInfo Game::mouse_info [protected]

Ref<OnScreenText> Game::ost [protected]

Pointer to on-screen-text object.

Ref<Selection> Game::selection [protected]

Pointer to selection object.


The documentation for this class was generated from the following files:
Generated on Sat Oct 20 14:47:31 2007 for Dark Oberon by  doxygen 1.5.3