#include <uimanager.h>
Inheritance diagram for UiManager:
Public Member Functions | |
DECLSPEC | UiManager (TiXmlElement *el, BasicObject *p) |
virtual const char * | getClassName () |
DECLSPEC void | loop (bool &stop) |
DECLSPEC void | handleEvents () |
DECLSPEC void | drawFrame () |
DECLSPEC void | setFocus (UiObject::FocusType f, UiObject *obj) |
DECLSPEC UiObject * | getFocus (UiObject::FocusType f) |
Uint32 | getTimePerFrame () const |
Uint32 | getFrames () const |
DECLSPEC Uint32 | getAvgTimePerFrame () const |
DECLSPEC void | setMaxFramerate (Uint32 n) |
Static Public Member Functions | |
static DECLSPEC UiManager * | getThe () |
Static Public Attributes | |
static UiManager * | the |
Protected Member Functions | |
virtual DECLSPEC void | onInit () |
Friends | |
class | ThemeManager |
UiManager is neccessary, if you want to use Netrinjo-supported graphical user interaction. It supports also keyboard and mouse input to non-graphical objects. This class recieves events from SDL and calls the corresponding functions of the focused objects and calls a function for display update in each cycle.
There is only one variable of this type allowed at a time. Do not initialize it more than once.
UiManager::UiManager | ( | TiXmlElement * | el, | |
BasicObject * | p | |||
) |
Constructor. The XML data may consist of the children "GuiManager" (to initialize the GuiManager) and "UiKeyCombination" (to set events for pressed key combinations).
el | the XML element | |
p | the parent object |
virtual const char* UiManager::getClassName | ( | ) | [inline, virtual] |
This function should be overriden in every sub-class of BasicObject!
Reimplemented from BasicObject.
void UiManager::loop | ( | bool & | stop | ) |
This function does not end, until stop becomes true (stop is set to false directly after the function is called). In the loop handleEvents() and nextFrame() are called.
stop | reference to a variable that indicates, when to stop the loop. |
void UiManager::handleEvents | ( | ) |
Handles events concerning the application and user input (mouse / keyboard). This function should be called regularly.
void UiManager::drawFrame | ( | ) |
Handles drawing of graphical objects... (usually called directly after/before handleEvents() in the main loop)
void UiManager::setFocus | ( | UiObject::FocusType | f, | |
UiObject * | obj | |||
) |
Sets the focus of keyboard, mouse or display to the specified object.
f | the kind of focus to set | |
obj | the object that will be focussed (may be NULL) |
UiObject * UiManager::getFocus | ( | UiObject::FocusType | f | ) |
f | the kind of focus to get |
Uint32 UiManager::getTimePerFrame | ( | ) | const [inline] |
Uint32 UiManager::getFrames | ( | ) | const [inline] |
Uint32 UiManager::getAvgTimePerFrame | ( | ) | const |
void UiManager::setMaxFramerate | ( | Uint32 | n | ) |
Limits the framerate by waiting, if the minimum time did not elapse. (This has no effect on the vertical or horizontal frequency of the monitor!)
n | the maximum number of frames per second allowed |
UiManager * UiManager::getThe | ( | ) | [static] |
void UiManager::onInit | ( | ) | [protected, virtual] |
Initializes the manager by setting it up, as the XML element says it. The XML data may consist of the children "GuiManager" (to initialize the GuiManager) and "UiKeyCombination" (to set events for pressed key combinations).
el | the XML element |
Reimplemented from BasicObject.
UiManager * UiManager::the [static] |
only accessible in Linux, and equals the result of getThe()