From 1a5b968d7e4fb9811579aed0a9df813938323062 Mon Sep 17 00:00:00 2001 From: James Turner Date: Sun, 3 Feb 2013 16:34:36 +0000 Subject: [PATCH] Update for tweaked SGPickCallback API. (Requires corresponding SimGear commit) --- src/Input/FGMouseInput.cxx | 20 ++++++++++++-------- src/Input/FGMouseInput.hxx | 2 +- src/Model/panelnode.cxx | 2 +- src/Scenery/scenery.cxx | 2 +- 4 files changed, 15 insertions(+), 11 deletions(-) diff --git a/src/Input/FGMouseInput.cxx b/src/Input/FGMouseInput.cxx index 8ebdb6bec..f55e7c41c 100644 --- a/src/Input/FGMouseInput.cxx +++ b/src/Input/FGMouseInput.cxx @@ -27,11 +27,13 @@ #endif #include "FGMouseInput.hxx" + +#include #include "Main/globals.hxx" using std::ios_base; -void ActivePickCallbacks::init( int b, const osgGA::GUIEventAdapter* ea ) +void ActivePickCallbacks::init( int button, const osgGA::GUIEventAdapter* ea ) { // Get the list of hit callbacks. Take the first callback that // accepts the mouse button press and ignore the rest of them @@ -39,13 +41,15 @@ void ActivePickCallbacks::init( int b, const osgGA::GUIEventAdapter* ea ) // The nearest one is the first one and the deepest // (the most specialized one in the scenegraph) is the first. std::vector pickList; - if (globals->get_renderer()->pick(pickList, ea)) { - std::vector::const_iterator i; - for (i = pickList.begin(); i != pickList.end(); ++i) { - if (i->callback->buttonPressed(b, i->info)) { - (*this)[b].push_back(i->callback); - return; - } + if (!globals->get_renderer()->pick(pickList, ea)) { + return; + } + + std::vector::const_iterator i; + for (i = pickList.begin(); i != pickList.end(); ++i) { + if (i->callback->buttonPressed(button, ea, i->info)) { + (*this)[button].push_back(i->callback); + return; } } } diff --git a/src/Input/FGMouseInput.hxx b/src/Input/FGMouseInput.hxx index ba0054ca0..01c6c2cbd 100644 --- a/src/Input/FGMouseInput.hxx +++ b/src/Input/FGMouseInput.hxx @@ -45,7 +45,7 @@ class ActivePickCallbacks : public std::map > > { public: void update( double dt ); - void init( int b, const osgGA::GUIEventAdapter* ea ); + void init( int button, const osgGA::GUIEventAdapter* ea ); }; diff --git a/src/Model/panelnode.cxx b/src/Model/panelnode.cxx index ac4256c1d..33d9d6a76 100644 --- a/src/Model/panelnode.cxx +++ b/src/Model/panelnode.cxx @@ -61,7 +61,7 @@ public: panel(p) {} - virtual bool buttonPressed(int b, const Info& info) + virtual bool buttonPressed(int b, const osgGA::GUIEventAdapter*, const Info& info) { button = b; // convert to panel coordinates diff --git a/src/Scenery/scenery.cxx b/src/Scenery/scenery.cxx index 5ed687e83..f9878ba05 100644 --- a/src/Scenery/scenery.cxx +++ b/src/Scenery/scenery.cxx @@ -59,7 +59,7 @@ using namespace simgear; class FGGroundPickCallback : public SGPickCallback { public: - virtual bool buttonPressed(int button, const Info& info) + virtual bool buttonPressed(int button, const osgGA::GUIEventAdapter*, const Info& info) { // only on left mouse button if (button != 0)