Hi Robert . I m using osg to check keys but i cant use both two keys. i m trying do the moves like Mario game where i can run and jump while running. But with osg i press to run next i press the jump key while running but when my "Mario" finish the jump I have to press run key again. with SDL id understand to run while I m pressing the key to run dont matter if other key is pressed together .
I m using this code like osgkeyboard example: rViewer->addEventHandler( new KeyboardEventHandler() ); // in the top of my main.cpp I have this class. these keys are temporary keys :) class KeyboardEventHandler : public osgGA::GUIEventHandler { public: KeyboardEventHandler() {} virtual bool handle(const osgGA::GUIEventAdapter& ea,osgGA::GUIActionAdapter&) { switch(ea.getEventType()) { case(osgGA::GUIEventAdapter::KEYDOWN): { if ( ea.getKey()==osgGA::GUIEventAdapter::KEY_F5 ) { anda_esquerda=true; anda_direita=false; } if ( ea.getKey()==osgGA::GUIEventAdapter::KEY_F6 ) { anda_direita=true; anda_esquerda=false; } if ( ea.getKey()==osgGA::GUIEventAdapter::KEY_Page_Up ) { if(( ceu->ind_col.at (0)==true)||(ceu->ind_col.at(1)==true)) anda_altura=true; } if ( ea.getKey()==osgGA::GUIEventAdapter::KEY_Page_Down ) { posz-=2.2; } return true; } break; case(osgGA::GUIEventAdapter::KEYUP): { anda_direita=false; anda_esquerda=false; return true; }break; default: return false; } } On Sun, Dec 7, 2008 at 9:25 AM, Robert Osfield <[EMAIL PROTECTED]>wrote: > HI Carlos, > > What is missing from the osgViewer supplied events that requires you > to use SDL? Perhaps adding the functionality into osgViewer/osgGA > would avoid the need for extra complexity. > > On the SDL front I've used for getting joystick events with an > osgViewer based application, but this doesn't require any keyboard > events - these all just come through the viewer like the OSG examples. > > Robert. > > > On Sat, Dec 6, 2008 at 3:58 PM, Carlos Sanches <[EMAIL PROTECTED]> wrote: > > > > Hi all ! > > Please ! > > I m trying to use SDL to take keyboard events , but when my program runs > is > > apearing two windows . one of my OSG program and other black of SDL . > when I > > click in the black screen my OSG objects move in the other screen. > > I only want to use SDL to keyboard because has the response that I want . > > Is there some way to dont appear the black screen and my OSG window read > my > > keyboard with SDL ?? > > I read this tutorial to do this until now but looks like that there is > old > > functions > > > > > http://www.cs.clemson.edu/~malloy/courses/3dgames-2007/tutor/web/controls/controls.html<http://www.cs.clemson.edu/%7Emalloy/courses/3dgames-2007/tutor/web/controls/controls.html> > > > > thank you ! > > > > _______________________________________________ > > osg-users mailing list > > osg-users@lists.openscenegraph.org > > > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org > > > > > _______________________________________________ > osg-users mailing list > osg-users@lists.openscenegraph.org > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org > -- Carlos Sanches Analista de Sistemas e computação gráfica Tel: 55 11 3816 2888 Cel: 55 11 9650 7137 Somar Meteorologia www.somarmeteorologia.com.br
_______________________________________________ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org