Orxonox: orxonox::GSGraphics Class Reference

# orxonox::GSGraphics Class Reference

Game state used when displaying graphics of any kind. Another blubb resides here. More...

`#include <src/orxonox/gamestates/GSGraphics.h>`

Inheritance diagram for orxonox::GSGraphics:

List of all members.

## Public Member Functions

void | activate ()
| This function is called when we enter this game state.
void | deactivate ()
| This function is called when the game state is left.
| GSGraphics (const GameStateConstrParams &params)
void | setConfigValues ()
| this function does nothing
void | toggleGUI ()
| Toggles the visibility of the current GUI.
void | update (const Clock &time)
| ~GSGraphics ()

## Private Member Functions

void | windowFocusChanged ()
| Window focus has changed.
void | windowResized (unsigned int newWidth, unsigned int newHeight)
| Window has resized.

## Private Attributes

ConsoleCommand * | ccToggleGUI_
| Console command to toggle GUI.
InGameConsole * | console_
XMLFile * | debugOverlay_
GraphicsManager * | graphicsManager_
| Interface to Ogre.
GUIManager * | guiManager_
| Interface to GUI.
InputManager * | inputManager_
| Reference to input management.
SimpleInputState * | masterInputState_
| Special input state for master input.
KeyBinder * | masterKeyBinder_
| Key binder for master key bindings.
SoundManager * | soundManager_
| Keeps track of SoundBase objects.

## Detailed Description

Game state used when displaying graphics of any kind. Another blubb resides here.

This game state is only left out if we start a dedicated server where no graphics are present.

## Constructor & Destructor Documentation

orxonox::GSGraphics::GSGraphics | ( | const GameStateConstrParams & | params | ) |

References RegisterRootObject.

orxonox::GSGraphics::~GSGraphics | ( |  | ) |

## Member Function Documentation

void orxonox::GSGraphics::activate | ( |  | ) | `[virtual]`

This function is called when we enter this game state.

Since graphics is very important for our game this function does quite a lot:

- starts graphics manager
- loads debug overlay
- manages render window
- creates input manager
- loads master key bindings
- loads the SoundManager
- loads ingame console
- loads GUI interface (GUIManager)
- creates console command to toggle GUI

Reimplemented from orxonox::GameState.

References orxonox::CommandExecutor::addConsoleCommandShortcut(), ccToggleGUI_, console_, COUT, orxonox::createConsoleCommand(), orxonox::InputManager::createInputState(), debugOverlay_, orxonox::InputManager::getInstance(), orxonox::GraphicsManager::getInstance(), orxonox::Core::getMediaPath(), orxonox::GraphicsManager::getRenderWindow(), graphicsManager_, guiManager_, orxonox::GUIManager::initialise(), orxonox::InGameConsole::initialise(), orxonox::InputManager::initialise(), inputManager_, masterInputState_, masterKeyBinder_, orxonox::Loader::open(), orxonox::InputManager::requestEnterState(), setConfigValues(), orxonox::SimpleInputState::setKeyHandler(), orxonox::FunctorMember< T >::setObject(), orxonox::GameMode::setShowsGraphics(), soundManager_, and toggleGUI().

void orxonox::GSGraphics::deactivate | ( |  | ) | `[virtual]`

This function is called when the game state is left.

Created references, input states and console commands are deleted.

Reimplemented from orxonox::GameState.

References console_, debugOverlay_, orxonox::InputManager::getInstance(), graphicsManager_, guiManager_, inputManager_, masterInputState_, masterKeyBinder_, orxonox::InputManager::requestDestroyState(), orxonox::SimpleInputState::setHandler(), orxonox::GameMode::setShowsGraphics(), soundManager_, and orxonox::Loader::unload().

void orxonox::GSGraphics::setConfigValues | ( |  | ) |

this function does nothing

Indeed. Here goes nothing.

Reimplemented from orxonox::OrxonoxClass.

Referenced by activate().

void orxonox::GSGraphics::toggleGUI | ( |  | ) |

Toggles the visibility of the current GUI.

This function just executes a Lua function in the main script of the GUI by accessing the GUIManager. For more details on this function check out the Lua code.

References orxonox::GUIManager::executeCode(), and orxonox::GUIManager::getInstance().

Referenced by activate().

void orxonox::GSGraphics::update | ( | const Clock & | time | ) | `[virtual]`

Note:
  A note about the Ogre::FrameListener: Even though we don't use them, they still get called. However, the delta times are not correct (except for timeSinceLastFrame, which is the most important). A little research as shown that there is probably only one FrameListener that doesn't even need the time. So we shouldn't run into problems.

Reimplemented from orxonox::GameState.

References orxonox::Game::addTickTime(), console_, orxonox::GameState::getActivity(), orxonox::Game::getInstance(), orxonox::Clock::getRealMicroseconds(), graphicsManager_, guiManager_, inputManager_, orxonox::Game::requestState(), orxonox::GraphicsManager::update(), orxonox::GUIManager::update(), orxonox::InGameConsole::update(), and orxonox::InputManager::update().

void orxonox::GSGraphics::windowFocusChanged | ( |  | ) | `[private, virtual]`

Window focus has changed.

Parameters:

  | rw | The render window it occured in

Reimplemented from orxonox::WindowEventListener.

References orxonox::InputManager::clearBuffers(), and inputManager_.

void orxonox::GSGraphics::windowResized | ( | unsigned int | newWidth,
|  | unsigned int | newHeight |
| ) |  |  | `[private, virtual]`

Window has resized.

Parameters:

  | rw | The render window it occured in

Note:
  GraphicsManager has a render window stored itself. This is the same as rw. But we have to be careful when using multiple render windows!

Reimplemented from orxonox::WindowEventListener.

References inputManager_, and orxonox::InputManager::setWindowExtents().

## Member Data Documentation

ConsoleCommand* orxonox::GSGraphics::ccToggleGUI_`[private]`

Console command to toggle GUI.

Referenced by activate().

InGameConsole* orxonox::GSGraphics::console_`[private]`

Referenced by activate(), deactivate(), and update().

XMLFile* orxonox::GSGraphics::debugOverlay_`[private]`

Referenced by activate(), and deactivate().

GraphicsManager* orxonox::GSGraphics::graphicsManager_`[private]`

Interface to Ogre.

Referenced by activate(), deactivate(), and update().

GUIManager* orxonox::GSGraphics::guiManager_`[private]`

Interface to GUI.

Referenced by activate(), deactivate(), and update().

InputManager* orxonox::GSGraphics::inputManager_`[private]`

Reference to input management.

Referenced by activate(), deactivate(), update(), windowFocusChanged(), and windowResized().

SimpleInputState* orxonox::GSGraphics::masterInputState_`[private]`

Special input state for master input.

Referenced by activate(), and deactivate().

KeyBinder* orxonox::GSGraphics::masterKeyBinder_`[private]`

Key binder for master key bindings.

Referenced by activate(), and deactivate().

SoundManager* orxonox::GSGraphics::soundManager_`[private]`

Keeps track of SoundBase objects.

Referenced by activate(), and deactivate().

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

- src/orxonox/gamestates/GSGraphics.h
- src/orxonox/gamestates/GSGraphics.cc