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
|
||||
|
||||
#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);
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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 );
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue