}
-osg::Vec2d eventToWindowCoords(const osgGA::GUIEventAdapter* ea)
+osg::Vec2d eventToWindowCoords(const osgGA::GUIEventAdapter& ea)
{
using namespace osg;
- const GraphicsContext* gc = ea->getGraphicsContext();
+ const GraphicsContext* gc = ea.getGraphicsContext();
const GraphicsContext::Traits* traits = gc->getTraits() ;
// Scale x, y to the dimensions of the window
- double x = (((ea->getX() - ea->getXmin()) / (ea->getXmax() - ea->getXmin()))
+ double x = (((ea.getX() - ea.getXmin()) / (ea.getXmax() - ea.getXmin()))
* (double)traits->width);
- double y = (((ea->getY() - ea->getYmin()) / (ea->getYmax() - ea->getYmin()))
+ double y = (((ea.getY() - ea.getYmin()) / (ea.getYmax() - ea.getYmin()))
* (double)traits->height);
- if (ea->getMouseYOrientation() == osgGA::GUIEventAdapter::Y_INCREASING_DOWNWARDS)
+ if (ea.getMouseYOrientation() == osgGA::GUIEventAdapter::Y_INCREASING_DOWNWARDS)
y = (double)traits->height - y;
return osg::Vec2d(x, y);
_hover = readBindingList(hoverNode->getChildren("binding"), modelRoot);
}
- virtual bool buttonPressed(int button, const osgGA::GUIEventAdapter* ea, const Info&)
+ virtual bool buttonPressed( int button,
+ const osgGA::GUIEventAdapter&,
+ const Info& )
{
if (_buttons.find(button) == _buttons.end()) {
return false;
_repeatTime = -_repeatInterval; // anti-bobble: delay start of repeat
return true;
}
- virtual void buttonReleased(int keyModState)
+ virtual void buttonReleased( int keyModState,
+ const osgGA::GUIEventAdapter&,
+ const Info* )
{
SG_UNUSED(keyModState);
fireBindingList(_bindingsUp);
}
}
- virtual bool hover(const osg::Vec2d& windowPos, const Info& info)
+ virtual bool hover( const osg::Vec2d& windowPos,
+ const Info& )
{
if (_hover.empty()) {
return false;
_squaredDown = dot(_toDown, _toDown);
}
- virtual bool buttonPressed(int button, const osgGA::GUIEventAdapter* ea, const Info& info)
+ virtual bool buttonPressed( int button,
+ const osgGA::GUIEventAdapter&,
+ const Info& info )
{
SGVec3d loc(info.local);
SG_LOG(SG_INPUT, SG_DEBUG, "VNC pressed " << button << ": " << loc);
return vv.wasSuccessful();
}
- virtual void buttonReleased(int keyModState)
+ virtual void buttonReleased( int keyModState,
+ const osgGA::GUIEventAdapter&,
+ const Info* )
{
SG_UNUSED(keyModState);
SG_LOG(SG_INPUT, SG_DEBUG, "VNC release");
pickGroup->setStateSet(sharedHighlightStateSet());
mainGroup->addChild(pickGroup);
- setupCallbacks(SGSceneUserData::getOrCreateSceneUserData(pickGroup), mainGroup);
+ setupCallbacks(SGSceneUserData::getOrCreateSceneUserData(mainGroup), mainGroup);
pickGroup->addChild(child);
group.removeChild(child);
}
}
- virtual bool buttonPressed(int button, const osgGA::GUIEventAdapter* ea, const Info&)
+ virtual bool buttonPressed( int button,
+ const osgGA::GUIEventAdapter& ea,
+ const Info& )
{
// the 'be nice to Mac / laptop' users option; alt-clicking spins the
// opposite direction. Should make this configurable
- if ((button == 0) && (ea->getModKeyMask() & osgGA::GUIEventAdapter::MODKEY_ALT)) {
+ if ((button == 0) && (ea.getModKeyMask() & osgGA::GUIEventAdapter::MODKEY_ALT)) {
button = 1;
}
return true;
}
- virtual void buttonReleased(int keyModState)
+ virtual void buttonReleased( int keyModState,
+ const osgGA::GUIEventAdapter&,
+ const Info* )
{
// for *clicks*, we only fire on button release
if (!_hasDragged) {
return _dragDirection;
}
- virtual void mouseMoved(const osgGA::GUIEventAdapter* ea)
+ virtual void mouseMoved( const osgGA::GUIEventAdapter& ea,
+ const Info* )
{
_mousePos = eventToWindowCoords(ea);
osg::Vec2d deltaMouse = _mousePos - _lastFirePos;
if (fabs(delta) >= 1.0) {
// determine direction from sign of delta
Direction dir = (delta > 0.0) ? DIRECTION_INCREASE : DIRECTION_DECREASE;
- fire(ea->getModKeyMask() & osgGA::GUIEventAdapter::MODKEY_SHIFT, dir);
+ fire(ea.getModKeyMask() & osgGA::GUIEventAdapter::MODKEY_SHIFT, dir);
_lastFirePos = _mousePos;
}
}
} // of repeat iteration
}
- virtual bool hover(const osg::Vec2d& windowPos, const Info& info)
+ virtual bool hover( const osg::Vec2d& windowPos,
+ const Info& )
{
if (_hover.empty()) {
return false;