Adding customized events
OSG uses an internal event queue to manage coming GUI events in a first in first out (FIFO) list. Events at the beginning will be handled first and then erased from the list. That is, the handle()
method of each added event handler will be executed as many times as the size of the event queue. The event queue class, named osgGA::EventQueue
, allows new events to be pushed in with the addEvent()
method at any time. Its argument is an osgGA::GUIEventAdapter
pointer, which uses setting methods like setEventType()
and setButton()
to define its behavior.
There are some additional methods of the osgGA::EventQueue
class that can be used to quickly set and add new GUI events. One of them is the userEvent()
method, which adapts user-defined events with a user data pointer as the argument. This user data can be used to represent any kind of customized event, for instance, the timer event described in the following section.
It is of no use to create a completely new event queue...