Gui Class Reference

Provides automatic generation of GUI elements. More...

#include <gui.h>

List of all members.

Public Member Functions

 Gui (irr::IrrlichtDevice *d, irr::core::stringc name, irr::core::rect< irr::s32 > position)
 ~Gui ()
void addSlider (irr::s32 id, irr::core::stringw text, irr::s32 initialValue)
irr::s32 getSliderValue (irr::s32 id)
void addButton (irr::s32 id, irr::core::stringw text)
void addText (irr::s32 id, irr::core::stringw text)
void setVisible (bool visible)
bool isVisible (void)
irr::core::stringc getTextFromID (irr::s32 id)
void setTextFromID (irr::s32 id, irr::core::stringw text)
void bringToFront (void)
 Sets root window top most.


Detailed Description

Provides automatic generation of GUI elements.

As you call addSlider(), addButton() or addText() a representative GUI element will be created and added to a IGUIWindow. As you implement an irr::IEventReceiver and have set it as current receiver inside irrlicht system, you will receive all GUI events and thus have to handle them. The root window grows when more elements were added than inital window can fit in.

Definition at line 13 of file gui.h.


Constructor & Destructor Documentation

Gui::Gui (  irr::IrrlichtDevice *  d,
irr::core::stringc  name,
irr::core::rect< irr::s32 >  position
) 
 

Constructor. Will create a IGUIWindow in which you can add elements with addSlider(), ...

Note:
Anywhere in your main-loop you have to call device->getGUIEnvironment()->drawAll().
Parameters:
d : An IrrlichDevice*, needed to access the IGUIEnvironment.
name : A string naming the GUI window.
position : A irr::core::rect (type = signed integer) defining position of apearence.

Gui::~Gui (   ) 
 

Destructor. Removes all added GUI emenets and the IGUIWindow.

Definition at line 20 of file gui.cpp.


Member Function Documentation

void Gui::addButton (  irr::s32  id,
irr::core::stringw  text
) 
 

Puts a button right under the last added GUI element.

Parameters:
id : A signed integer, identifying this element for further calls. All id's have to be unique.
text : A string describing this element.

Referenced by StateTerrain::entry(), StateMenu::entry(), and StateFlockSimulation::entry().

void Gui::addSlider (  irr::s32  id,
irr::core::stringw  text,
irr::s32  initialValue
) 
 

Puts a horizontal slider right under the last added GUI element.

Parameters:
id : A signed integer, identifying this element for further calls. All id's have to be unique.
text : A string describing this element.
initialValue : A signed integer defining the initial position of the movable slider thing.
Note:
This also adds a text element above the slider where parameter "text" and paramter "initialValue" is shown for user convinience.

Referenced by StateFlockSimulation::entry().

void Gui::addText (  irr::s32  id,
irr::core::stringw  text
) 
 

Puts a satic text right under the last added GUI element.

Parameters:
id : A signed integer, identifying this element for further calls. All id's have to be unique.
text : A string describing this element.

Referenced by StateFlockSimulation::entry().

irr::s32 Gui::getSliderValue (  irr::s32  id  ) 
 

Gets position (current value) of the movalble slider thing.

Parameters:
id : A signed integer identifying the slider
Returns:
Returns a signed integer as position of slider.
Note:
This also updates the text element assigned to this slider with current slider value.

irr::core::stringc Gui::getTextFromID (  irr::s32  id  ) 
 

Parameters:
id : A signed integer identifying a GUI element.
Returns:
Returns a string describing the GUI element (if set).

bool Gui::isVisible (  void   ) 
 

Useful to control menus on/off by keyboard input.

Returns:
Returns True, if GUI is drawn (visible).

Definition at line 154 of file gui.cpp.

void Gui::setTextFromID (  irr::s32  id,
irr::core::stringw  text
) 
 

Usefule to store text in GUI text and button elements.

Parameters:
id : A signed integer, identifying this element for further calls. All id's have to be unique.
text : A string describing this element.

void Gui::setVisible (  bool  visible  ) 
 

Disables GUI drawing, no GUI will be seen.

Parameters:
visible : A boolean. If True, GUI will be drawn.

Definition at line 142 of file gui.cpp.

Referenced by StateTerrain::entry().


The documentation for this class was generated from the following files:
Generated on Sun Dec 2 17:09:58 2007 for Swarm by  doxygen 1.4.6-NO