sonus::Graphics Class Reference

#include <Graphics.h>

List of all members.

Public Member Functions

virtual bool Graphics::OnEvent (SEvent event)
 ~Graphics ()
void initLevel (Level2D *level)
void update (Level2D *level)
void beginRender ()
void renderViewports ()
void renderConsole ()
void renderStatus ()
void renderBlend ()
void endRender ()
void addGlobalFunction (irr::EKEY_CODE irrKey, void(*pfunction)())
void addGlobalBoolean (irr::EKEY_CODE irrKey, bool *value, bool setValue)
void addIncrementalValue (irr::EKEY_CODE irrKey, int *value, int min, int max, int step)
void setChangingValue (const char *name, int *value, int step)

Static Public Member Functions

static GraphicsgetInstance ()

Public Attributes

std::wstringstream consoleText
scene::ISceneManager * smgr
IrrlichtDevice * device
video::IVideoDriver * driver
gui::IGUIEnvironment * env
gui::IGUIStaticText * textbox
gui::IGUIStaticText * status
int viewportMode
double portalAnimation
bool portalAnimationFinished
int portalBlend
long portalAnimationStart
Vector2DtransformationVector
double scaleFactor

Static Public Attributes

static bool fullscreen
static int resolutionX
static int resolutionY


Detailed Description

sonus::Graphics

According to the MVC pattern and with the application itself being the model, this module implements the view and the controller. All graphical output acts as the view and the key listeners together with the Graphics::OnEvent() function are the controller(s). The class implements the singleton pattern to enable graphical debugging in all modules. It has different methods for rendering viewports and user text. The module uses the Irrlicht engine. The class is derived from the basic event listening class of Irrlicht.

filename: Graphics.h

Date:
2008/04/27 18:09
Author:
Alexander Lawrence
Version:
1.0
See also:
ChangingValue

GlobalBoolean

GlobalFunction

IncrementalValue

irr::IEventReceiver


Constructor & Destructor Documentation

sonus::Graphics::~Graphics (  ) 

Destructor.


Member Function Documentation

virtual bool sonus::Graphics::Graphics::OnEvent ( SEvent  event  )  [virtual]

This method implements all controller behavior. It processes all key inputs and invokes all callback behavior (functions or changing values) associated with certain keys.

See also:
ChangingValue

GlobalBoolean

GlobalFunction

IncrementalValue

irr::IEventReceiver

Parameters:
event the received event
Returns:
see base class

static Graphics* sonus::Graphics::getInstance (  )  [inline, static]

Standard singleton function to retrieve the only instance. If instance does not exist it is created.

Returns:
the singleton instance of graphics module

void sonus::Graphics::initLevel ( Level2D level  ) 

Initializes a new level by adding player, portal, obstacles and border to the Irrlicht scene.

Parameters:
level new level
See also:
sonus::Level2D

void sonus::Graphics::update ( Level2D level  ) 

Updates the current level setup by updating Irrlicht scene nodes. Basically just updating the player´s position. Note the graphics module is only a reading module.

Parameters:
level current level
See also:
sonus::Level2D

sonus::Application

void sonus::Graphics::beginRender (  ) 

Makes the engine ready to render.

void sonus::Graphics::renderViewports (  ) 

Renders all current viewports. Through Graphics::viewportMode you can set which viewports are rendered (valid values = [0..4]).

void sonus::Graphics::renderConsole (  ) 

Renders the text console. Text can be added to the console through the stringstream consoleText.

See also:
std::stringstream

void sonus::Graphics::renderStatus (  ) 

Renders the status text field. The status textfield either shows "GAME" or "REPLAY". Text can be changed by accessing the status attribute (IGUIStaticText).

See also:
irr::gui::IGUIStaticText

void sonus::Graphics::renderBlend (  ) 

Renders the global white blend (if enabled). The blend is used for the level transitions.

void sonus::Graphics::endRender (  ) 

Completes the render process. Make sure you call this method after beginRender().

See also:
sonus::Graphics::beginRender()

void sonus::Graphics::addGlobalFunction ( irr::EKEY_CODE  irrKey,
void(*)()  pfunction 
)

Adds a global callback function for a certain key to the key listeners.

Parameters:
irrKey key code to listen to
pfunction pointer to the callback function
See also:
sonus::GlobalFunction

irr::EKEY_CODE

void sonus::Graphics::addGlobalBoolean ( irr::EKEY_CODE  irrKey,
bool *  value,
bool  setValue 
)

Adds a global boolean for a certain key to the key listeners.

Parameters:
irrKey key code to listen to
value pointer to boolean to be changed
setValue value the boolean will be set to
See also:
sonus::GlobalBoolean

irr::EKEY_CODE

void sonus::Graphics::addIncrementalValue ( irr::EKEY_CODE  irrKey,
int *  value,
int  min,
int  max,
int  step 
)

Adds a incremental value for a certain key to the key listeners. Every time the key is pressed the value is incremented by the step. If you pass a negative value as step the value is in fact decremented. After every incrementation the value is checked against min and max to enable boundaries for the value.

Parameters:
irrKey key code to listen to
value pointer to value to be incremented / decremented
min minimal value
max minimal value
See also:
sonus::IncrementalValue

irr::EKEY_CODE

void sonus::Graphics::setChangingValue ( const char *  name,
int *  value,
int  step 
)

Sets the global changing value. The changing value can be altered by pressing +/-. Therefore there can only be one changing value at the time.

Parameters:
name name of changing value
value pointer to changing value
step step value
See also:
sonus::ChangingValue


The documentation for this class was generated from the following file:
Generated on Tue Aug 26 12:26:54 2008 for sonus by  doxygen 1.5.4