#include <Graphics.h>
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 Graphics * | getInstance () |
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 |
| Vector2D * | transformationVector |
| double | scaleFactor |
Static Public Attributes | |
| static bool | fullscreen |
| static int | resolutionX |
| static int | resolutionY |
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
irr::IEventReceiver
| sonus::Graphics::~Graphics | ( | ) |
Destructor.
| 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.
irr::IEventReceiver
| event | the received event |
| static Graphics* sonus::Graphics::getInstance | ( | ) | [inline, static] |
Standard singleton function to retrieve the only instance. If instance does not exist it is created.
| void sonus::Graphics::initLevel | ( | Level2D * | level | ) |
Initializes a new level by adding player, portal, obstacles and border to the Irrlicht scene.
| level | new level |
| 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.
| level | current level |
| 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.
| 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).
| 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().
| void sonus::Graphics::addGlobalFunction | ( | irr::EKEY_CODE | irrKey, | |
| void(*)() | pfunction | |||
| ) |
Adds a global callback function for a certain key to the key listeners.
| irrKey | key code to listen to | |
| pfunction | pointer to the callback function |
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.
| irrKey | key code to listen to | |
| value | pointer to boolean to be changed | |
| setValue | value the boolean will be set to |
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.
| irrKey | key code to listen to | |
| value | pointer to value to be incremented / decremented | |
| min | minimal value | |
| max | minimal value |
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.
| name | name of changing value | |
| value | pointer to changing value | |
| step | step value |
1.5.4