ui::Gui Class Reference

Collaboration diagram for ui::Gui:

Collaboration graph
[legend]
List of all members.

Detailed Description

The Gui class manages everything related to the Gui. It has several methods which need to be called in order for the Gui to fully work. There should only be one Gui in your whole program. This does not mean you cannot have more than one user interface, just only one Gui instance. To create more than one interface, use multiple Frame instances and register them with your Gui instance.


Public Member Functions

void addFrame (Frame *frame)
void removeFrame (Frame *frame)
void paint ()
void importMouseMotion (int x, int y)
void importMousePressed (int button)
void importMouseReleased (int button)
void importKeyPressed (int keyCode, int modifier)
void importKeyReleased (int keyCode, int modifier)
void importUpdate (float deltaTime)
void setFontFactory (AbstractFontFactory *factory)
AbstractFontFactorygetFontFactory () const


Member Function Documentation

void ui::Gui::addFrame Frame frame  ) 
 

Add a frame instance to the Gui manager.

Parameters:
frame Frame to be added to the Gui.
Note:
Note that frames are rendered in the order they are added.

void ui::Gui::removeFrame Frame frame  ) 
 

Removes a frame instance from the Gui manager. This means the frame will no longer be painted or updated. If you just disable a Frame temporarely, the setVisible(false) or hide() options are a better choice than removing the frame from the Gui.

Parameters:
frame Frame to be removed from the Gui.

void ui::Gui::paint  ) 
 

Draw the Gui. This should be called every frame, and if possible when in orthographic mode.

void ui::Gui::importMouseMotion int  x,
int  y
 

Send mouse coordinates to the Gui. This should be done everyframe, as the mouse coordinates are used by the picking engine.

void ui::Gui::importMousePressed int  button  ) 
 

Send a mouse press to the Gui.

Parameters:
button The button that was pressed. Valid values are stored in /event/MouseEvent.h:
  • MOUSE_BUTTON1 - Left mouse button
  • MOUSE_BUTTON2 - Right mouse button
  • MOUSE_BUTTON3 - Third button
  • MOUSE_SCROLL_UP - Scroll wheel up
  • MOUSE_SCROLL_DOWN - Scroll wheel down
These values are stored in an enum, so it is advisable to use the enumerated constants instead of integers.
See also:
MouseEvent

void ui::Gui::importMouseReleased int  button  ) 
 

Send a mouse release to the Gui.

Parameters:
button The button that was released. Valid values are stored in MouseEvent
  • MOUSE_BUTTON1 - Left mouse button
  • MOUSE_BUTTON2 - Right mouse button
  • MOUSE_BUTTON3 - Third button
  • MOUSE_SCROLL_UP - Scroll wheel up
  • MOUSE_SCROLL_DOWN - Scroll wheel down
These values are stored in an enum, so it is advisable to use the enumerated constants instead of integers.
See also:
MouseEvent

void ui::Gui::importKeyPressed int  keyCode,
int  modifier
 

Send a key press to the Gui. Possible values for the parameters can be found in KeyEvent

See also:
KeyEvent

void ui::Gui::importKeyReleased int  keyCode,
int  modifier
 

Send a key release to the Gui. Possible values for the parameters can be found in KeyEvent

See also:
KeyEvent

void ui::Gui::importUpdate float  deltaTime  ) 
 

Send a time based update to the Gui.

Parameters:
deltaTime the delta time between the last two frames.
Note:
This is not required, but all time based motion in the Gui will not work if you do not call this function.

void ui::Gui::setFontFactory AbstractFontFactory factory  ) 
 

Sets the font factory for the Gui. Font factories are used to create all Fonts in the system, and have to be implemented by the end user. Also see the online article.

AbstractFontFactory * ui::Gui::getFontFactory  )  const
 

Returns the FontFactory currently in use.


Generated on Mon Jun 20 19:41:44 2005 for UI by doxygen 1.3.1 using KingsTools