Guiliani  Version 2.5 revision 7293 (documentation build 13)
Guiliani's main loop

Page contents

Introduction

Once you have created your GUI instance and started it by calling the CGUI::Run() method, Guiliani will run in an endless loop, until you explicitly request the framework to quit. While running, the framework will repeatedly perform several tasks, reaching from the retrieval of user input, via the handling of incoming events, to the final visual update of the presented GUI. Knowledge of this core loop is helpful in getting a general understanding of how Guiliani works. The following diagram outlines the flow of this main loop:

Retrieve user input

This checks for user input from attached input devices (e.g. keyboard, mouse, touchscreen) It is in this place that Guiliani interfaces with the platform specifc input media that was instantiated during startup of the application. Guiliani will sleep here if there is no input waiting to be processed. The maximum sleep time is dependent on any active animations or command objects.

See also
CGUIInputMedia for further details.

Process Events

The Event handler forwards incoming events to the respective objects within the GUI. This will typically be the currently focused object, or the uppermost object at a given screen position in case of a mouse event. At this point of the loop Guiliani will call the corresponding event handling slots (e.g. DoClick, DoDrag, GetFocus...).

See also
Input event handling for further details.

Process command objects

The command handler checks whether there are any commands available in the command queue and awaiting execution. If yes, it will call the respective command's Do() methods.

See also
CGUICommand for further details.

Process Animations

If the specified time interval of a given animation has expired, the timer will call the corresponding object's DoAnimate() methods.

See also
CGUITimer for further details.

Redraw the GUI

Guiliani will process the regions which have been invalidated since the last redraw, and will call the DoDraw() methods of all objects overlapping with these. Ultimately Guiliani will instruct the graphics wrapper to update the screen.

See also
Invalidating and redrawing for further details.