Added an EventQueue directly into osgProducer::Viewer.

This commit is contained in:
Robert Osfield
2006-03-13 13:19:37 +00:00
parent 8229875432
commit 1a16d6d6b0
9 changed files with 49 additions and 24 deletions

View File

@@ -31,7 +31,7 @@ class OSGGA_EXPORT EventQueue : public osg::Referenced
{
public:
EventQueue();
EventQueue(GUIEventAdapter::MouseYOrientation mouseYOrientation=GUIEventAdapter::Y_INCREASING_DOWNWARDS);
typedef std::list< osg::ref_ptr<GUIEventAdapter> > Events;

View File

@@ -63,6 +63,7 @@ class OSGPRODUCER_EXPORT KeyboardMouseCallback : public Producer::KeyboardMouseC
// local methods and members
typedef osgGA::EventQueue::Events EventQueue;
void setEventQueue(osgGA::EventQueue* eventQueue) { _eventQueue = eventQueue; }
osgGA::EventQueue* getEventQueue() { return _eventQueue.get(); }
bool takeEventQueue(EventQueue& queue);

View File

@@ -255,6 +255,12 @@ class OSGPRODUCER_EXPORT Viewer : public OsgCameraGroup, public osgGA::GUIAction
/** Compute, from normalized mouse coords, for all Cameras, intersections with the scene.*/
bool computeIntersections(float x,float y,osgUtil::IntersectVisitor::HitList& hits,osg::Node::NodeMask traversalMask = 0xffffffff);
/** Set the EventQueue - a thread safe queue for registering events.*/
void setEventQueue(osgGA::EventQueue* eventQueue) { _eventQueue = eventQueue; }
/** Get the EventQueue.*/
osgGA::EventQueue* getEventQueue() { return _eventQueue.get(); }
void setKeyboardMouse(Producer::KeyboardMouse* kbm);
Producer::KeyboardMouse* getKeyboardMouse() { return _kbm.get(); }
const Producer::KeyboardMouse* getKeyboardMouse() const { return _kbm.get(); }
@@ -310,6 +316,8 @@ class OSGPRODUCER_EXPORT Viewer : public OsgCameraGroup, public osgGA::GUIAction
bool _writeImageWhenDone;
std::string _writeImageFileName;
osg::ref_ptr<osgGA::EventQueue> _eventQueue;
osg::ref_ptr<Producer::KeyboardMouse> _kbm;
osg::ref_ptr<osgProducer::KeyboardMouseCallback> _kbmcb;