]> git.mxchange.org Git - flightgear.git/commitdiff
Update for tweaked SGPickCallback API.
authorJames Turner <zakalawe@mac.com>
Sun, 3 Feb 2013 16:34:36 +0000 (16:34 +0000)
committerJames Turner <zakalawe@mac.com>
Sun, 3 Feb 2013 16:34:36 +0000 (16:34 +0000)
(Requires corresponding SimGear commit)

src/Input/FGMouseInput.cxx
src/Input/FGMouseInput.hxx
src/Model/panelnode.cxx
src/Scenery/scenery.cxx

index 8ebdb6becffdd8419e97a137fe794e3cc595ac9a..f55e7c41c82304b101dbea21732e62884e0249f0 100644 (file)
 #endif
 
 #include "FGMouseInput.hxx"
+
+#include <osgGA/GUIEventAdapter>
 #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<SGSceneryPick> pickList;
-  if (globals->get_renderer()->pick(pickList, ea)) {
-    std::vector<SGSceneryPick>::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<SGSceneryPick>::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;
     }
   }
 }
index ba0054ca0c38f46e58ab0a41d359115a71a10ad2..01c6c2cbdcacef848ca45f99059be48b8d107db0 100644 (file)
@@ -45,7 +45,7 @@
 class ActivePickCallbacks : public std::map<int, std::list<SGSharedPtr<SGPickCallback> > > {
 public:
   void update( double dt );
-  void init( int b, const osgGA::GUIEventAdapter* ea );
+  void init( int button, const osgGA::GUIEventAdapter* ea );
 };
 
 
index ac4256c1d14b0b57d6a90c68c53e78d871da4db8..33d9d6a76b69138c3a8095f9bf17a9b542bd83ee 100644 (file)
@@ -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
index 5ed687e83c3175e9f0acfd70a39931c4b11b6b80..f9878ba05e35f9736d1da8a29953e430a87d89b3 100644 (file)
@@ -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)