Hello,

I've developed a simple library for generating and handling GUI-like
events on scene graph nodes. Basically, it allows to register
callbacks that get executed when a certain node is clicked, or the
mouse is moved over it, for instance.

The implementation is still in a very early stage. I am releasing it
now just because there is another guy in the lab wanting to use it,
and therefore I had to put it in a releasable state anyway.

Here is a snippet showing its use:

// OSGUIsh::NodePtr is just a typedef for 'osg::ref_ptr<osg::Node>'
void HandleClick (const osgGA::GUIEventAdapter& ea, OSGUIsh::NodePtr node)
{
  std::cout << "Node '" << node.get() << " clicked'!\n";
}

int main()
{
  // ...
  osg::ref_ptr<OSGUIsh::EventHandler> guishEH(
     new OSGUIsh::EventHandler (viewer));
  viewer.getEventHandlerList().push_front (guishEH.get());
  // ...
  guishEH->addNode (anOSGNode);
  guishEH->getSignal (anOSGNode, "MouseMove")->connect (&HandleClick);
  // ...
}

So, if anyone thinks it is useful, feel free to use it:
http://www.stackedboxes.org/Projects/OSGUIsh

Cheers,

LMB
...oh, yes, I tend to create really bad names for my programs...
_______________________________________________
osg-users mailing list
osg-users@openscenegraph.net
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/

Reply via email to