Update for tweaked SGPickCallback API.
(Requires corresponding SimGear commit)
This commit is contained in:
parent
978a2cd8c6
commit
1a5b968d7e
4 changed files with 15 additions and 11 deletions
|
@ -27,11 +27,13 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "FGMouseInput.hxx"
|
#include "FGMouseInput.hxx"
|
||||||
|
|
||||||
|
#include <osgGA/GUIEventAdapter>
|
||||||
#include "Main/globals.hxx"
|
#include "Main/globals.hxx"
|
||||||
|
|
||||||
using std::ios_base;
|
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
|
// Get the list of hit callbacks. Take the first callback that
|
||||||
// accepts the mouse button press and ignore the rest of them
|
// 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 nearest one is the first one and the deepest
|
||||||
// (the most specialized one in the scenegraph) is the first.
|
// (the most specialized one in the scenegraph) is the first.
|
||||||
std::vector<SGSceneryPick> pickList;
|
std::vector<SGSceneryPick> pickList;
|
||||||
if (globals->get_renderer()->pick(pickList, ea)) {
|
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;
|
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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,7 +45,7 @@
|
||||||
class ActivePickCallbacks : public std::map<int, std::list<SGSharedPtr<SGPickCallback> > > {
|
class ActivePickCallbacks : public std::map<int, std::list<SGSharedPtr<SGPickCallback> > > {
|
||||||
public:
|
public:
|
||||||
void update( double dt );
|
void update( double dt );
|
||||||
void init( int b, const osgGA::GUIEventAdapter* ea );
|
void init( int button, const osgGA::GUIEventAdapter* ea );
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -61,7 +61,7 @@ public:
|
||||||
panel(p)
|
panel(p)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
virtual bool buttonPressed(int b, const Info& info)
|
virtual bool buttonPressed(int b, const osgGA::GUIEventAdapter*, const Info& info)
|
||||||
{
|
{
|
||||||
button = b;
|
button = b;
|
||||||
// convert to panel coordinates
|
// convert to panel coordinates
|
||||||
|
|
|
@ -59,7 +59,7 @@ using namespace simgear;
|
||||||
|
|
||||||
class FGGroundPickCallback : public SGPickCallback {
|
class FGGroundPickCallback : public SGPickCallback {
|
||||||
public:
|
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
|
// only on left mouse button
|
||||||
if (button != 0)
|
if (button != 0)
|
||||||
|
|
Loading…
Reference in a new issue