Added createEvent() convinience method.

This commit is contained in:
Robert Osfield
2006-03-15 15:49:21 +00:00
parent cbc2668c5c
commit 85edf40fcb
2 changed files with 9 additions and 0 deletions

View File

@@ -84,6 +84,9 @@ class OSGGA_EXPORT EventQueue : public osg::Referenced
double getTime() const { return osg::Timer::instance()->delta_s(_startTick, osg::Timer::instance()->tick()); }
/** convinience method for create an event ready to fill in. Clones the getCurrentEventState() to produce a up to date event state. */
GUIEventAdapter* createEvent();
GUIEventAdapter* getCurrentEventState() { return _accumulateEventState.get(); }
const GUIEventAdapter* getCurrentEventState() const { return _accumulateEventState.get(); }

View File

@@ -255,3 +255,9 @@ void EventQueue::frame(double t)
addEvent(event);
}
GUIEventAdapter* EventQueue::createEvent()
{
if (_accumulateEventState.valid()) return new GUIEventAdapter(*_accumulateEventState.get());
else return new GUIEventAdapter();
}