[osg-users] Multiple key strokes handle in OSG
OpenSceneGraph Users
osg-users at lists.openscenegraph.org
Fri May 1 08:58:57 PDT 2020
Hi All.
I am using OSG in my Project. I Have a requirement to handle the
combination keys from KeyBoard,For E.g ctrl + S , ctrl + q etc.
Seeing the documentation i have inherited my class from
osgGA::GUIEventHandler and implemented handle virtual function to recieve
the keyboard Events.
Here is my Handle Function
bool MyKeyboardHandle::handle(const osgGA::GUIEventAdapter& ea,
osgGA::GUIActionAdapter& aa)
{
viewer = dynamic_cast<osgViewer::View*>(&aa);
if (viewer)
{
switch (ea.getEventType())
{
case(osgGA::GUIEventAdapter::KEYDOWN):
{
if (ea.getModKeyMask() &
osgGA::GUIEventAdapter::MODKEY_CTRL)
{
if (ea.getKey() == osgGA::GUIEventAdapter::KEY_S)
{
//call my specific function here
. // I want to call my function here
}
}
}
break;
default:
break;
}
}
return false;
}
If i debug my program, i can see control reaching until this condition if
(ea.getModKeyMask() & osgGA::GUIEventAdapter::MODKEY_CTRL) when i press
combination keys( ctrl + s) . But next if condition fails where i am
checking if the key pressed is 's'.
Can you guys guide me is my code correct to handle combination keys from
keyboard, If you can guide to any examples, that will really helpful
Thanks & Rgds
santhosh
--
You received this message because you are subscribed to the Google Groups "OpenSceneGraph Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to osg-users+unsubscribe at googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/osg-users/e54835af-6e75-44d3-97ab-017ea100040c%40googlegroups.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20200501/4149ab01/attachment.html>
More information about the osg-users
mailing list