Hi,

I've just started using osg, and i've tried the tutorials, like the "Handling 
Keyboard Input to Update a Callback" tutorial, and i wrote the following code:

        
Code:
osgViewer::Viewer viewer;
        ObjectManipulator* displayHandler = new ObjectManipulator();
        viewer.addEventHandler(displayHandler); 
        viewer.setSceneData(geode);
        viewer.setUpViewInWindow(100, 100, 800, 600); 
        viewer.run();



and


Code:
#include <osgGA/GUIEventHandler>
class ObjectManipulator: public osgGA::GUIEventHandler
{
public:
        virtual bool handle(const osgGA::GUIEventAdapter& ea, 
osgGA::GUIActionAdapter& aa);
        virtual void accept(osgGA::GUIEventHandlerVisitor& v)   { 
v.visit(*this); };
};

bool ObjectManipulator::handle(const osgGA::GUIEventAdapter& 
ea,osgGA::GUIActionAdapter& aa)
{       
  switch(ea.getEventType())
  {
    case(osgGA::GUIEventAdapter::KEYDOWN):
    {
       switch(ea.getKey())
      {
        case 'w':
            std::cout << " w key pressed" << std::endl;
            return false;
            break;
        default:
            return false;
      }                         
    }
    default:
      return false;  
  }
}



The problem is that it never gets inside the 
case(osgGA::GUIEventAdapter::KEYDOWN) instruction; Do I need to include 
anything else? or why doesn't it work?

Thank you!
  Nadia[/code]

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=14433#14433





_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to