Hi,
I'm looking at the OpenSceneGraph trunk sources, and saw something under
"src/osgGA/EventQueue.cpp" that I wanted to mention:
Within the function
Code:
void EventQueue::mouseButtonPress(float x, float y, unsigned int button, double
time)
the following switch() statement is found:
Code:
switch(button)
{
case(1):
_accumulateEventState->setButtonMask(GUIEventAdapter::LEFT_MOUSE_BUTTON |
_accumulateEventState->getButtonMask());
break;
case(2):
_accumulateEventState->setButtonMask(GUIEventAdapter::MIDDLE_MOUSE_BUTTON |
_accumulateEventState->getButtonMask());
break;
case(3):
_accumulateEventState->setButtonMask(GUIEventAdapter::RIGHT_MOUSE_BUTTON |
_accumulateEventState->getButtonMask());
break;
}
Since the hard-coded values "1", "2" and "3" are defined through an enum within
"include/osgGA/EventQueue" to be "1", "2" and "3" (respectively) for the values
LEFT_MOUSE_BUTTON, MIDDLE_MOUSE_BUTTON, and RIGHT_MOUSE_BUTTON, I was wondering
why this code isn't simply adapted to be:
Code:
switch(button)
{
case(GUIEventAdapter::LEFT_MOUSE_BUTTON): // fall-through
case(GUIEventAdapter::MIDDLE_MOUSE_BUTTON): // fall-through
case(GUIEventAdapter::RIGHT_MOUSE_BUTTON):
_accumulateEventState->setButtonMask(button |
_accumulateEventState->getButtonMask());
break;
}
It seems as though the functionality would be identical, though there is no
"default:" case defined action.
Feedback, of course, is welcome.
Thank you!
Cheers,
OnlineCop[/code]
------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=17666#17666
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org