Converted osgGA::GUIEventAdapter into a concrete class capable of respresenting
keyboard and mouse events. Added osgGA::EventQueue class to support a thread safe event queue and adaption of keyboard and mouse events. Removed osgProducer::EventAdapter as GUIEventAdapter replaces it. Adapted osgProducer and examples to work with the new changes to osgGA.
This commit is contained in:
@@ -57,7 +57,7 @@ void AnimationPathManipulator::home(double currentTime)
|
||||
|
||||
void AnimationPathManipulator::home(const GUIEventAdapter& ea,GUIActionAdapter&)
|
||||
{
|
||||
home(ea.time());
|
||||
home(ea.getTime());
|
||||
}
|
||||
|
||||
void AnimationPathManipulator::init(const GUIEventAdapter& ea,GUIActionAdapter& aa)
|
||||
@@ -78,7 +78,7 @@ bool AnimationPathManipulator::handle(const osgGA::GUIEventAdapter& ea,osgGA::GU
|
||||
}
|
||||
else
|
||||
{
|
||||
handleFrame( ea.time() );
|
||||
handleFrame( ea.getTime() );
|
||||
}
|
||||
return false;
|
||||
case GUIEventAdapter::KEYDOWN:
|
||||
@@ -96,12 +96,12 @@ bool AnimationPathManipulator::handle(const osgGA::GUIEventAdapter& ea,osgGA::GU
|
||||
if( _isPaused )
|
||||
{
|
||||
_isPaused = false;
|
||||
_timeOffset -= ea.time() - _pauseTime;
|
||||
_timeOffset -= ea.getTime() - _pauseTime;
|
||||
}
|
||||
else
|
||||
{
|
||||
_isPaused = true;
|
||||
_pauseTime = ea.time();
|
||||
_pauseTime = ea.getTime();
|
||||
}
|
||||
us.requestRedraw();
|
||||
us.requestContinuousUpdate(false);
|
||||
|
||||
@@ -486,7 +486,7 @@ bool DriveManipulator::calcMovement()
|
||||
// return if less then two events have been added.
|
||||
if (_ga_t0.get()==NULL || _ga_t1.get()==NULL) return false;
|
||||
|
||||
double dt = _ga_t0->time()-_ga_t1->time();
|
||||
double dt = _ga_t0->getTime()-_ga_t1->getTime();
|
||||
|
||||
if (dt<0.0f)
|
||||
{
|
||||
|
||||
@@ -234,7 +234,7 @@ bool FlightManipulator::calcMovement()
|
||||
if (_ga_t0.get()==NULL || _ga_t1.get()==NULL) return false;
|
||||
|
||||
|
||||
double dt = _ga_t0->time()-_ga_t1->time();
|
||||
double dt = _ga_t0->getTime()-_ga_t1->getTime();
|
||||
|
||||
if (dt<0.0f)
|
||||
{
|
||||
|
||||
@@ -9,6 +9,7 @@ CXXFILES = \
|
||||
EventVisitor.cpp\
|
||||
FlightManipulator.cpp\
|
||||
UFOManipulator.cpp\
|
||||
EventQueue.cpp\
|
||||
GUIEventAdapter.cpp\
|
||||
GUIEventHandler.cpp\
|
||||
GUIEventHandlerVisitor.cpp\
|
||||
|
||||
@@ -11,10 +11,53 @@
|
||||
* OpenSceneGraph Public License for more details.
|
||||
*/
|
||||
|
||||
#include <osgGA/GUIEventHandler>
|
||||
#include <osgGA/GUIEventAdapter>
|
||||
|
||||
using namespace osgGA;
|
||||
|
||||
GUIEventAdapter::GUIEventAdapter():
|
||||
_eventType(NONE),
|
||||
_time(0.0),
|
||||
_key(0),
|
||||
_button(0),
|
||||
_Xmin(0.0),
|
||||
_Xmax(1.0),
|
||||
_Ymin(0.0),
|
||||
_Ymax(1.0),
|
||||
_mx(0.5),
|
||||
_my(0.5),
|
||||
_buttonMask(0),
|
||||
_modKeyMask(0),
|
||||
_scrollingMotion(SCROLL_DOWN),
|
||||
_mouseYOrientation(Y_INCREASING_DOWNWARDS)
|
||||
{}
|
||||
|
||||
GUIEventAdapter::GUIEventAdapter(const GUIEventAdapter& rhs):
|
||||
Referenced(),
|
||||
_eventType(rhs._eventType),
|
||||
_time(rhs._time),
|
||||
_key(rhs._key),
|
||||
_button(rhs._button),
|
||||
_Xmin(rhs._Xmin),
|
||||
_Xmax(rhs._Xmax),
|
||||
_Ymin(rhs._Ymin),
|
||||
_Ymax(rhs._Ymax),
|
||||
_mx(rhs._mx),
|
||||
_my(rhs._my),
|
||||
_buttonMask(rhs._buttonMask),
|
||||
_modKeyMask(rhs._modKeyMask),
|
||||
_scrollingMotion(rhs._scrollingMotion),
|
||||
_mouseYOrientation(rhs._mouseYOrientation)
|
||||
{}
|
||||
|
||||
GUIEventAdapter::~GUIEventAdapter()
|
||||
{
|
||||
}
|
||||
|
||||
void GUIEventAdapter::setWindowSize(float Xmin, float Ymin, float Xmax, float Ymax)
|
||||
{
|
||||
_Xmin = Xmin;
|
||||
_Ymin = Ymin;
|
||||
_Xmax = Xmax;
|
||||
_Ymax = Ymax;
|
||||
}
|
||||
|
||||
@@ -20,15 +20,14 @@ using namespace osgGA;
|
||||
void GUIEventHandler::operator()(osg::Node* node, osg::NodeVisitor* nv)
|
||||
{
|
||||
osgGA::EventVisitor* ev = dynamic_cast<osgGA::EventVisitor*>(nv);
|
||||
if (ev && ev->getActionAdapter() && !ev->getEventList().empty())
|
||||
if (ev && ev->getActionAdapter() && !ev->getEvents().empty())
|
||||
{
|
||||
for(osgGA::EventVisitor::EventList::iterator itr = ev->getEventList().begin();
|
||||
itr != ev->getEventList().end();
|
||||
for(osgGA::EventQueue::Events::iterator itr = ev->getEvents().begin();
|
||||
itr != ev->getEvents().end();
|
||||
++itr)
|
||||
{
|
||||
if (handle(*(*itr), *(ev->getActionAdapter()), node, nv))
|
||||
{
|
||||
ev->setEventHandled(true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -39,10 +38,10 @@ void GUIEventHandler::operator()(osg::Node* node, osg::NodeVisitor* nv)
|
||||
void GUIEventHandler::event(osg::NodeVisitor* nv, osg::Drawable* drawable)
|
||||
{
|
||||
osgGA::EventVisitor* ev = dynamic_cast<osgGA::EventVisitor*>(nv);
|
||||
if (ev && ev->getActionAdapter() && !ev->getEventList().empty())
|
||||
if (ev && ev->getActionAdapter() && !ev->getEvents().empty())
|
||||
{
|
||||
for(osgGA::EventVisitor::EventList::iterator itr = ev->getEventList().begin();
|
||||
itr != ev->getEventList().end();
|
||||
for(osgGA::EventQueue::Events::iterator itr = ev->getEvents().begin();
|
||||
itr != ev->getEvents().end();
|
||||
++itr)
|
||||
{
|
||||
handle(*(*itr), *(ev->getActionAdapter()), drawable, nv);
|
||||
|
||||
@@ -288,7 +288,7 @@ bool NodeTrackerManipulator::isMouseMoving()
|
||||
float dx = _ga_t0->getXnormalized()-_ga_t1->getXnormalized();
|
||||
float dy = _ga_t0->getYnormalized()-_ga_t1->getYnormalized();
|
||||
float len = sqrtf(dx*dx+dy*dy);
|
||||
float dt = _ga_t0->time()-_ga_t1->time();
|
||||
float dt = _ga_t0->getTime()-_ga_t1->getTime();
|
||||
|
||||
return (len>dt*velocity);
|
||||
}
|
||||
|
||||
@@ -189,7 +189,7 @@ bool TerrainManipulator::isMouseMoving()
|
||||
float dx = _ga_t0->getXnormalized()-_ga_t1->getXnormalized();
|
||||
float dy = _ga_t0->getYnormalized()-_ga_t1->getYnormalized();
|
||||
float len = sqrtf(dx*dx+dy*dy);
|
||||
float dt = _ga_t0->time()-_ga_t1->time();
|
||||
float dt = _ga_t0->getTime()-_ga_t1->getTime();
|
||||
|
||||
return (len>dt*velocity);
|
||||
}
|
||||
|
||||
@@ -54,7 +54,7 @@ void TrackballManipulator::home(double /*currentTime*/)
|
||||
|
||||
void TrackballManipulator::home(const GUIEventAdapter& ea ,GUIActionAdapter& us)
|
||||
{
|
||||
home(ea.time());
|
||||
home(ea.getTime());
|
||||
us.requestRedraw();
|
||||
}
|
||||
|
||||
@@ -167,7 +167,7 @@ bool TrackballManipulator::isMouseMoving()
|
||||
float dx = _ga_t0->getXnormalized()-_ga_t1->getXnormalized();
|
||||
float dy = _ga_t0->getYnormalized()-_ga_t1->getYnormalized();
|
||||
float len = sqrtf(dx*dx+dy*dy);
|
||||
float dt = _ga_t0->time()-_ga_t1->time();
|
||||
float dt = _ga_t0->getTime()-_ga_t1->getTime();
|
||||
|
||||
return (len>dt*velocity);
|
||||
}
|
||||
|
||||
@@ -161,14 +161,14 @@ void UFOManipulator::computeHomePosition()
|
||||
|
||||
void UFOManipulator::init(const GUIEventAdapter&, GUIActionAdapter&)
|
||||
{
|
||||
//home(ea.time());
|
||||
//home(ea.getTime());
|
||||
|
||||
_stop();
|
||||
}
|
||||
|
||||
void UFOManipulator::home(const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter&)
|
||||
{
|
||||
home(ea.time());
|
||||
home(ea.getTime());
|
||||
}
|
||||
|
||||
void UFOManipulator::home(double)
|
||||
@@ -398,17 +398,17 @@ void UFOManipulator::_keyDown( const osgGA::GUIEventAdapter &ea, osgGA::GUIActio
|
||||
break;
|
||||
|
||||
case 'H':
|
||||
home(ea.time());
|
||||
home(ea.getTime());
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void UFOManipulator::_frame( const osgGA::GUIEventAdapter &ea, osgGA::GUIActionAdapter & )
|
||||
{
|
||||
double t1 = ea.time();
|
||||
double t1 = ea.getTime();
|
||||
if( _t0 == 0.0 )
|
||||
{
|
||||
_t0 = ea.time();
|
||||
_t0 = ea.getTime();
|
||||
_dt = 0.0;
|
||||
}
|
||||
else
|
||||
|
||||
@@ -1,229 +0,0 @@
|
||||
#include <osgProducer/EventAdapter>
|
||||
|
||||
using namespace osgProducer;
|
||||
|
||||
// default to no mouse buttons being pressed.
|
||||
unsigned int EventAdapter::_s_accumulatedButtonMask = 0;
|
||||
|
||||
int EventAdapter::_s_button = 0;
|
||||
int EventAdapter::_s_modKeyMask = 0;
|
||||
float EventAdapter::_s_Xmin = 0;
|
||||
float EventAdapter::_s_Xmax = 1280;
|
||||
float EventAdapter::_s_Ymin = 0;
|
||||
float EventAdapter::_s_Ymax = 1024;
|
||||
float EventAdapter::_s_mx = 0;
|
||||
float EventAdapter::_s_my = 0;
|
||||
|
||||
EventAdapter::EventAdapter():
|
||||
osgGA::GUIEventAdapter(osgGA::GUIEventAdapter::Y_INCREASING_UPWARDS)
|
||||
{
|
||||
_eventType = NONE; // adaptor does not encapsulate any events.
|
||||
_key = -1; // set to 'invalid' key value.
|
||||
_button = -1; // set to 'invalid' button value.
|
||||
_mx = -1; // set to 'invalid' position value.
|
||||
_my = -1; // set to 'invalid' position value.
|
||||
_buttonMask = 0; // default to no mouse buttons being pressed.
|
||||
_modKeyMask = 0; // default to no mouse buttons being pressed.
|
||||
_time = 0.0f; // default to no time has been set.
|
||||
|
||||
copyStaticVariables();
|
||||
|
||||
}
|
||||
|
||||
|
||||
void EventAdapter::copyStaticVariables()
|
||||
{
|
||||
_buttonMask = _s_accumulatedButtonMask;
|
||||
_modKeyMask = _s_modKeyMask;
|
||||
_button = _s_button;
|
||||
_Xmin = _s_Xmin;
|
||||
_Xmax = _s_Xmax;
|
||||
_Ymin = _s_Ymin;
|
||||
_Ymax = _s_Ymax;
|
||||
_mx = _s_mx;
|
||||
_my = _s_my;
|
||||
}
|
||||
|
||||
|
||||
void EventAdapter::setWindowSize(float Xmin, float Ymin, float Xmax, float Ymax)
|
||||
{
|
||||
_s_Xmin = Xmin;
|
||||
_s_Xmax = Xmax;
|
||||
_s_Ymin = Ymin;
|
||||
_s_Ymax = Ymax;
|
||||
}
|
||||
|
||||
|
||||
void EventAdapter::setButtonMask(unsigned int buttonMask)
|
||||
{
|
||||
_s_accumulatedButtonMask = buttonMask;
|
||||
}
|
||||
|
||||
|
||||
void EventAdapter::adaptResize(double time, float Xmin, float Ymin, float Xmax, float Ymax)
|
||||
{
|
||||
setWindowSize(Xmin,Ymin,Xmax,Ymax);
|
||||
_eventType = RESIZE;
|
||||
_time = time;
|
||||
copyStaticVariables();
|
||||
}
|
||||
|
||||
void EventAdapter::adaptMouseScroll(double time, Producer::KeyboardMouseCallback::ScrollingMotion sm)
|
||||
{
|
||||
_time = time;
|
||||
|
||||
if (sm == Producer::KeyboardMouseCallback::ScrollUp)
|
||||
_eventType = SCROLLUP;
|
||||
else if (sm == Producer::KeyboardMouseCallback::ScrollDown)
|
||||
_eventType = SCROLLDOWN;
|
||||
else
|
||||
_eventType = NONE;
|
||||
|
||||
copyStaticVariables();
|
||||
}
|
||||
|
||||
void EventAdapter::adaptButtonPress(double time,float x, float y, unsigned int button)
|
||||
{
|
||||
_time = time;
|
||||
|
||||
_eventType = PUSH;
|
||||
_button = button-1;
|
||||
|
||||
switch(_button)
|
||||
{
|
||||
case(0):
|
||||
_s_accumulatedButtonMask = _s_accumulatedButtonMask | LEFT_MOUSE_BUTTON;
|
||||
_s_button = LEFT_MOUSE_BUTTON;
|
||||
break;
|
||||
case(1):
|
||||
_s_accumulatedButtonMask = _s_accumulatedButtonMask | MIDDLE_MOUSE_BUTTON;
|
||||
_s_button = MIDDLE_MOUSE_BUTTON;
|
||||
break;
|
||||
case(2):
|
||||
_s_accumulatedButtonMask = _s_accumulatedButtonMask | RIGHT_MOUSE_BUTTON;
|
||||
_s_button = RIGHT_MOUSE_BUTTON;
|
||||
break;
|
||||
}
|
||||
|
||||
_s_mx = x;
|
||||
_s_my = y;
|
||||
|
||||
copyStaticVariables();
|
||||
}
|
||||
|
||||
void EventAdapter::adaptButtonRelease(double time,float x, float y, unsigned int button)
|
||||
{
|
||||
_time = time;
|
||||
|
||||
_eventType = RELEASE;
|
||||
_button = button-1;
|
||||
|
||||
switch(_button)
|
||||
{
|
||||
case(0):
|
||||
_s_accumulatedButtonMask = _s_accumulatedButtonMask & ~LEFT_MOUSE_BUTTON;
|
||||
_s_button = LEFT_MOUSE_BUTTON;
|
||||
break;
|
||||
case(1):
|
||||
_s_accumulatedButtonMask = _s_accumulatedButtonMask & ~MIDDLE_MOUSE_BUTTON;
|
||||
_s_button = MIDDLE_MOUSE_BUTTON;
|
||||
break;
|
||||
case(2):
|
||||
_s_accumulatedButtonMask = _s_accumulatedButtonMask & ~RIGHT_MOUSE_BUTTON;
|
||||
_s_button = RIGHT_MOUSE_BUTTON;
|
||||
break;
|
||||
}
|
||||
|
||||
_s_mx = x;
|
||||
_s_my = y;
|
||||
|
||||
copyStaticVariables();
|
||||
}
|
||||
|
||||
/** method for adapting mouse motion events whilst mouse buttons are pressed.*/
|
||||
void EventAdapter::adaptMouseMotion(double time, float x, float y)
|
||||
{
|
||||
|
||||
_eventType = (_s_accumulatedButtonMask) ?
|
||||
DRAG :
|
||||
MOVE;
|
||||
|
||||
_time = time;
|
||||
_s_mx = x;
|
||||
_s_my = y;
|
||||
copyStaticVariables();
|
||||
|
||||
}
|
||||
|
||||
|
||||
/** method for adapting keyboard events.*/
|
||||
void EventAdapter::adaptKeyPress( double time, Producer::KeySymbol key)
|
||||
{
|
||||
_eventType = KEYDOWN;
|
||||
_time = time;
|
||||
_key = key;
|
||||
|
||||
switch(key)
|
||||
{
|
||||
case(KEY_Shift_L): _s_modKeyMask = MODKEY_LEFT_SHIFT | _s_modKeyMask; break;
|
||||
case(KEY_Shift_R): _s_modKeyMask = MODKEY_RIGHT_SHIFT | _s_modKeyMask; break;
|
||||
case(KEY_Control_L): _s_modKeyMask = MODKEY_LEFT_CTRL | _s_modKeyMask; break;
|
||||
case(KEY_Control_R): _s_modKeyMask = MODKEY_RIGHT_CTRL | _s_modKeyMask; break;
|
||||
case(KEY_Meta_L): _s_modKeyMask = MODKEY_LEFT_META | _s_modKeyMask; break;
|
||||
case(KEY_Meta_R): _s_modKeyMask = MODKEY_RIGHT_META | _s_modKeyMask; break;
|
||||
case(KEY_Alt_L): _s_modKeyMask = MODKEY_LEFT_ALT | _s_modKeyMask; break;
|
||||
case(KEY_Alt_R): _s_modKeyMask = MODKEY_LEFT_ALT | _s_modKeyMask; break;
|
||||
|
||||
case(KEY_Caps_Lock):
|
||||
{
|
||||
if ((_s_modKeyMask & MODKEY_CAPS_LOCK)!=0)
|
||||
_s_modKeyMask = ~MODKEY_CAPS_LOCK & _s_modKeyMask;
|
||||
else
|
||||
_s_modKeyMask = MODKEY_CAPS_LOCK | _s_modKeyMask;
|
||||
break;
|
||||
}
|
||||
case(KEY_Num_Lock):
|
||||
{
|
||||
if ((_s_modKeyMask & MODKEY_NUM_LOCK)!=0)
|
||||
_s_modKeyMask = ~MODKEY_NUM_LOCK & _s_modKeyMask;
|
||||
else
|
||||
_s_modKeyMask = MODKEY_NUM_LOCK | _s_modKeyMask;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
copyStaticVariables();
|
||||
}
|
||||
|
||||
void EventAdapter::adaptKeyRelease( double time, Producer::KeySymbol key)
|
||||
{
|
||||
// we won't handle this correctly right now.. GUIEventAdapter isn't up to it
|
||||
_eventType = KEYUP;
|
||||
_time = time;
|
||||
_key = key;
|
||||
|
||||
switch(key)
|
||||
{
|
||||
case(KEY_Shift_L): _s_modKeyMask = ~MODKEY_LEFT_SHIFT & _s_modKeyMask; break;
|
||||
case(KEY_Shift_R): _s_modKeyMask = ~MODKEY_RIGHT_SHIFT & _s_modKeyMask; break;
|
||||
case(KEY_Control_L): _s_modKeyMask = ~MODKEY_LEFT_CTRL & _s_modKeyMask; break;
|
||||
case(KEY_Control_R): _s_modKeyMask = ~MODKEY_RIGHT_CTRL & _s_modKeyMask; break;
|
||||
case(KEY_Meta_L): _s_modKeyMask = ~MODKEY_LEFT_META & _s_modKeyMask; break;
|
||||
case(KEY_Meta_R): _s_modKeyMask = ~MODKEY_RIGHT_META & _s_modKeyMask; break;
|
||||
case(KEY_Alt_L): _s_modKeyMask = ~MODKEY_LEFT_ALT & _s_modKeyMask; break;
|
||||
case(KEY_Alt_R): _s_modKeyMask = ~MODKEY_LEFT_ALT & _s_modKeyMask; break;
|
||||
}
|
||||
|
||||
copyStaticVariables();
|
||||
}
|
||||
|
||||
|
||||
|
||||
/** method for adapting frame events, i.e. iddle/display callback.*/
|
||||
void EventAdapter::adaptFrame(double time)
|
||||
{
|
||||
_eventType = FRAME;
|
||||
_time = time;
|
||||
|
||||
copyStaticVariables();
|
||||
}
|
||||
@@ -2,7 +2,6 @@ TOPDIR = ../..
|
||||
include $(TOPDIR)/Make/makedefs
|
||||
|
||||
CXXFILES =\
|
||||
EventAdapter.cpp\
|
||||
KeyboardMouseCallback.cpp\
|
||||
GraphicsContextImplementation.cpp\
|
||||
OsgCameraGroup.cpp\
|
||||
|
||||
@@ -7,212 +7,98 @@
|
||||
|
||||
using namespace osgProducer;
|
||||
|
||||
KeyboardMouseCallback::KeyboardMouseCallback(Producer::KeyboardMouse* keyboardMouse, bool &done, bool escapeKeySetsDone):
|
||||
Producer::KeyboardMouseCallback(),
|
||||
_keyboardMouse(keyboardMouse),
|
||||
_mx(0.0f),_my(0.0f),_mbutton(0),
|
||||
_done(done),
|
||||
_escapeKeySetsDone(escapeKeySetsDone)
|
||||
{
|
||||
_eventQueue = new osgGA::EventQueue;
|
||||
_eventQueue->getCurrentEventState()->setMouseYOrientation(osgGA::GUIEventAdapter::Y_INCREASING_UPWARDS);
|
||||
updateWindowSize();
|
||||
}
|
||||
|
||||
void KeyboardMouseCallback::mouseScroll( Producer::KeyboardMouseCallback::ScrollingMotion sm )
|
||||
{
|
||||
osg::ref_ptr<EventAdapter> event = createEventAdapter();
|
||||
|
||||
_eventQueueMutex.lock();
|
||||
event->adaptMouseScroll(getTime(), sm);
|
||||
_eventQueue.push_back(event);
|
||||
_eventQueueMutex.unlock();
|
||||
updateWindowSize();
|
||||
_eventQueue->mouseScroll((osgGA::GUIEventAdapter::ScrollingMotion)sm);
|
||||
}
|
||||
|
||||
void KeyboardMouseCallback::buttonPress( float mx, float my, unsigned int mbutton )
|
||||
{
|
||||
_mx = mx;
|
||||
_my = my;
|
||||
_mbutton |= (1<<(mbutton-1));
|
||||
|
||||
osg::ref_ptr<EventAdapter> event = createEventAdapter();
|
||||
|
||||
_eventQueueMutex.lock();
|
||||
event->adaptButtonPress(getTime(),mx,my,mbutton);
|
||||
_eventQueue.push_back(event);
|
||||
_eventQueueMutex.unlock();
|
||||
updateWindowSize();
|
||||
_eventQueue->mouseButtonPress(mx,my,mbutton);
|
||||
}
|
||||
|
||||
void KeyboardMouseCallback::buttonRelease( float mx, float my, unsigned int mbutton )
|
||||
{
|
||||
_mx = mx;
|
||||
_my = my;
|
||||
_mbutton &= ~(1<<(mbutton-1));
|
||||
|
||||
osg::ref_ptr<EventAdapter> event = createEventAdapter();
|
||||
|
||||
_eventQueueMutex.lock();
|
||||
event->adaptButtonRelease(getTime(),mx,my,mbutton);
|
||||
_eventQueue.push_back(event);
|
||||
_eventQueueMutex.unlock();
|
||||
updateWindowSize();
|
||||
_eventQueue->mouseButtonRelease(mx,my,mbutton);
|
||||
}
|
||||
|
||||
void KeyboardMouseCallback::doubleButtonPress( float mx, float my, unsigned int mbutton )
|
||||
{
|
||||
_mx = mx;
|
||||
_my = my;
|
||||
_mbutton |= (1<<(mbutton-1));
|
||||
|
||||
osg::ref_ptr<EventAdapter> event = createEventAdapter();
|
||||
|
||||
_eventQueueMutex.lock();
|
||||
event->adaptButtonPress(getTime(),mx,my,mbutton);
|
||||
_eventQueue.push_back(event);
|
||||
_eventQueueMutex.unlock();
|
||||
updateWindowSize();
|
||||
_eventQueue->mouseButtonPress(mx,my,mbutton);
|
||||
}
|
||||
|
||||
void KeyboardMouseCallback::keyPress( Producer::KeyCharacter key )
|
||||
{
|
||||
osg::ref_ptr<EventAdapter> event = createEventAdapter();
|
||||
|
||||
_eventQueueMutex.lock();
|
||||
event->adaptKeyPress(getTime(),key);
|
||||
_eventQueue.push_back(event);
|
||||
_eventQueueMutex.unlock();
|
||||
updateWindowSize();
|
||||
_eventQueue->keyPress((osgGA::GUIEventAdapter::KeySymbol)key);
|
||||
|
||||
// check against adapted key symbol.
|
||||
if (_escapeKeySetsDone &&
|
||||
event->getKey()==osgGA::GUIEventAdapter::KEY_Escape) _done = true;
|
||||
(osgGA::GUIEventAdapter::KeySymbol)key==osgGA::GUIEventAdapter::KEY_Escape) _done = true;
|
||||
}
|
||||
|
||||
void KeyboardMouseCallback::keyRelease( Producer::KeyCharacter key )
|
||||
{
|
||||
osg::ref_ptr<EventAdapter> event = createEventAdapter();
|
||||
|
||||
_eventQueueMutex.lock();
|
||||
event->adaptKeyRelease(getTime(),key);
|
||||
_eventQueue.push_back(event);
|
||||
_eventQueueMutex.unlock();
|
||||
updateWindowSize();
|
||||
_eventQueue->keyRelease((osgGA::GUIEventAdapter::KeySymbol)key);
|
||||
}
|
||||
|
||||
void KeyboardMouseCallback::specialKeyPress( Producer::KeyCharacter key )
|
||||
{
|
||||
osg::ref_ptr<EventAdapter> event = createEventAdapter();
|
||||
|
||||
_eventQueueMutex.lock();
|
||||
event->adaptKeyPress(getTime(),key);
|
||||
_eventQueue.push_back(event);
|
||||
_eventQueueMutex.unlock();
|
||||
|
||||
// check against adapted key symbol.
|
||||
if (_escapeKeySetsDone &&
|
||||
event->getKey()==osgGA::GUIEventAdapter::KEY_Escape) _done = true;
|
||||
updateWindowSize();
|
||||
keyPress(key);
|
||||
}
|
||||
|
||||
void KeyboardMouseCallback::specialKeyRelease( Producer::KeyCharacter key )
|
||||
{
|
||||
osg::ref_ptr<EventAdapter> event = createEventAdapter();
|
||||
|
||||
_eventQueueMutex.lock();
|
||||
event->adaptKeyRelease(getTime(),key);
|
||||
_eventQueue.push_back(event);
|
||||
_eventQueueMutex.unlock();
|
||||
updateWindowSize();
|
||||
keyRelease(key);
|
||||
}
|
||||
|
||||
void KeyboardMouseCallback::windowConfig( int x, int y, unsigned int width, unsigned int height )
|
||||
{
|
||||
osg::ref_ptr<EventAdapter> event = createEventAdapter();
|
||||
|
||||
_eventQueueMutex.lock();
|
||||
event->adaptResize(getTime(), x, y, x+width, y+height );
|
||||
_eventQueue.push_back(event);
|
||||
_eventQueueMutex.unlock();
|
||||
updateWindowSize();
|
||||
_eventQueue->windowResize(x,y,x+width,y+height);
|
||||
}
|
||||
|
||||
void KeyboardMouseCallback::mouseMotion( float mx, float my)
|
||||
{
|
||||
_mx = mx;
|
||||
_my = my;
|
||||
|
||||
osg::ref_ptr<EventAdapter> event = createEventAdapter();
|
||||
|
||||
_eventQueueMutex.lock();
|
||||
event->adaptMouseMotion(getTime(),mx,my);
|
||||
_eventQueue.push_back(event);
|
||||
_eventQueueMutex.unlock();
|
||||
|
||||
updateWindowSize();
|
||||
_eventQueue->mouseMotion(mx,my);
|
||||
}
|
||||
|
||||
void KeyboardMouseCallback::passiveMouseMotion( float mx, float my)
|
||||
{
|
||||
_mx = mx;
|
||||
_my = my;
|
||||
|
||||
//std::cout << "mx="<<mx<<" my="<<my<<std::endl;
|
||||
|
||||
osg::ref_ptr<EventAdapter> event = createEventAdapter();
|
||||
|
||||
_eventQueueMutex.lock();
|
||||
event->adaptMouseMotion(getTime(),mx,my);
|
||||
_eventQueue.push_back(event);
|
||||
_eventQueueMutex.unlock();
|
||||
|
||||
updateWindowSize();
|
||||
_eventQueue->mouseMotion(mx,my);
|
||||
}
|
||||
|
||||
void KeyboardMouseCallback::mouseWarp( float mx, float my)
|
||||
{
|
||||
_mx = mx;
|
||||
_my = my;
|
||||
|
||||
osg::ref_ptr<EventAdapter> event = createEventAdapter();
|
||||
|
||||
_eventQueueMutex.lock();
|
||||
_eventQueue.push_back(event);
|
||||
_eventQueueMutex.unlock();
|
||||
|
||||
updateWindowSize();
|
||||
_eventQueue->mouseMotion(mx,my); // need mouse warp??
|
||||
}
|
||||
|
||||
double KeyboardMouseCallback::getEventQueue(EventQueue& queue)
|
||||
|
||||
void KeyboardMouseCallback::updateWindowSize()
|
||||
{
|
||||
double swapTime;
|
||||
|
||||
queue.clear();
|
||||
_eventQueueMutex.lock();
|
||||
_eventQueue.swap(queue);
|
||||
swapTime = getTime();
|
||||
_eventQueueMutex.unlock();
|
||||
|
||||
return swapTime;
|
||||
}
|
||||
|
||||
double KeyboardMouseCallback::copyEventQueue(EventQueue& queue) const
|
||||
{
|
||||
double swapTime;
|
||||
|
||||
queue.clear();
|
||||
_eventQueueMutex.lock();
|
||||
queue = _eventQueue;
|
||||
swapTime = getTime();
|
||||
_eventQueueMutex.unlock();
|
||||
|
||||
return swapTime;
|
||||
}
|
||||
|
||||
double KeyboardMouseCallback::setEventQueue(EventQueue& queue)
|
||||
{
|
||||
double swapTime;
|
||||
|
||||
_eventQueueMutex.lock();
|
||||
_eventQueue = queue;
|
||||
swapTime = getTime();
|
||||
_eventQueueMutex.unlock();
|
||||
|
||||
return swapTime;
|
||||
}
|
||||
|
||||
double KeyboardMouseCallback::appendEventQueue(EventQueue& queue)
|
||||
{
|
||||
double swapTime;
|
||||
|
||||
_eventQueueMutex.lock();
|
||||
_eventQueue.insert(_eventQueue.end(),queue.begin(),queue.end());
|
||||
swapTime = getTime();
|
||||
_eventQueueMutex.unlock();
|
||||
|
||||
return swapTime;
|
||||
}
|
||||
|
||||
EventAdapter* KeyboardMouseCallback::createEventAdapter()
|
||||
{
|
||||
EventAdapter* ea = new EventAdapter;
|
||||
osgGA::GUIEventAdapter* ea = _eventQueue->getCurrentEventState();
|
||||
|
||||
Producer::InputArea* ia = _keyboardMouse->getInputArea();
|
||||
Producer::RenderSurface* rs = _keyboardMouse->getRenderSurface();
|
||||
@@ -257,8 +143,27 @@ EventAdapter* KeyboardMouseCallback::createEventAdapter()
|
||||
|
||||
ea->setWindowSize(minX,minY,maxX,maxY);
|
||||
}
|
||||
|
||||
return ea;
|
||||
}
|
||||
|
||||
bool KeyboardMouseCallback::takeEventQueue(EventQueue& queue)
|
||||
{
|
||||
updateWindowSize();
|
||||
return _eventQueue->takeEvents(queue);
|
||||
}
|
||||
|
||||
bool KeyboardMouseCallback::copyEventQueue(EventQueue& queue) const
|
||||
{
|
||||
return _eventQueue->copyEvents(queue);
|
||||
}
|
||||
|
||||
void KeyboardMouseCallback::setEventQueue(EventQueue& queue)
|
||||
{
|
||||
_eventQueue->setEvents(queue);
|
||||
}
|
||||
|
||||
void KeyboardMouseCallback::appendEventQueue(EventQueue& queue)
|
||||
{
|
||||
_eventQueue->appendEvents(queue);
|
||||
}
|
||||
|
||||
void KeyboardMouseCallback::shutdown()
|
||||
@@ -266,3 +171,8 @@ void KeyboardMouseCallback::shutdown()
|
||||
_done = true;
|
||||
_keyboardMouse->cancel();
|
||||
}
|
||||
|
||||
osgGA::GUIEventAdapter* KeyboardMouseCallback::createEventAdapter()
|
||||
{
|
||||
return new osgGA::GUIEventAdapter(*(_eventQueue->getCurrentEventState()));
|
||||
}
|
||||
|
||||
@@ -363,7 +363,7 @@ void Viewer::setUpViewer(unsigned int options)
|
||||
if (!_kbmcb)
|
||||
_kbmcb = new osgProducer::KeyboardMouseCallback( _kbm.get(), _done, (options & ESCAPE_SETS_DONE)!=0 );
|
||||
|
||||
_kbmcb->setStartTick(_start_tick);
|
||||
_kbmcb->getEventQueue()->setStartTick(_start_tick);
|
||||
|
||||
// register the callback with the keyboard mouse manger.
|
||||
_kbm->setCallback( _kbmcb.get() );
|
||||
@@ -541,8 +541,9 @@ bool Viewer::realize()
|
||||
{
|
||||
_keyswitchManipulator->setCoordinateFrameCallback(new ViewerCoordinateFrameCallback(this));
|
||||
|
||||
osg::ref_ptr<osgProducer::EventAdapter> init_event = _kbmcb->createEventAdapter();
|
||||
init_event->adaptFrame(0.0);
|
||||
osg::ref_ptr<osgGA::GUIEventAdapter> init_event = new osgGA::GUIEventAdapter;
|
||||
init_event->setEventType(osgGA::GUIEventAdapter::FRAME);
|
||||
init_event->setTime(0.0);
|
||||
|
||||
_keyswitchManipulator->setNode(getTopMostSceneData());
|
||||
_keyswitchManipulator->home(*init_event,*this);
|
||||
@@ -565,14 +566,12 @@ void Viewer::update()
|
||||
if (_kbm.valid() && !_kbm->isRunning()) _kbm->update(*(_kbm->getCallback()));
|
||||
#endif
|
||||
|
||||
// create an event to signal the new frame.
|
||||
_kbmcb->getEventQueue()->frame(_frameStamp->getReferenceTime());
|
||||
|
||||
// get the event since the last frame.
|
||||
osgProducer::KeyboardMouseCallback::EventQueue queue;
|
||||
if (_kbmcb.valid()) _kbmcb->getEventQueue(queue);
|
||||
|
||||
// create an event to signal the new frame.
|
||||
osg::ref_ptr<osgProducer::EventAdapter> frame_event = new osgProducer::EventAdapter;
|
||||
frame_event->adaptFrame(_frameStamp->getReferenceTime());
|
||||
queue.push_back(frame_event);
|
||||
if (_kbmcb.valid()) _kbmcb->takeEventQueue(queue);
|
||||
|
||||
if (_eventVisitor.valid())
|
||||
{
|
||||
@@ -842,9 +841,11 @@ void Viewer::selectCameraManipulator(unsigned int no)
|
||||
// keyswitch manipulator doesn't yet force manipulators to init themselves
|
||||
// so we'll do this mannually. Note pretty, and needs replacing by a refactor
|
||||
// of MatrixMinpulators in the longer term.
|
||||
osg::ref_ptr<EventAdapter> ea = new EventAdapter;
|
||||
osg::ref_ptr<osgGA::GUIEventAdapter> ea = new osgGA::GUIEventAdapter;
|
||||
double time = _kbmcb.valid() ? _kbmcb->getTime() : 0.0;
|
||||
ea->adaptKeyPress(time, osgGA::GUIEventAdapter::KEY_KP_1+no);
|
||||
ea->setTime(time);
|
||||
ea->setEventType(osgGA::GUIEventAdapter::KEYDOWN);
|
||||
ea->setKey(osgGA::GUIEventAdapter::KEY_KP_1+no);
|
||||
_keyswitchManipulator->init(*ea, *this);
|
||||
}
|
||||
}
|
||||
@@ -914,8 +915,8 @@ void Viewer::requestWarpPointer(float x,float y)
|
||||
{
|
||||
osg::notify(osg::INFO) << "requestWarpPointer x= "<<x<<" y="<<y<<std::endl;
|
||||
|
||||
EventAdapter::_s_mx = x;
|
||||
EventAdapter::_s_my = y;
|
||||
_kbmcb->getEventQueue()->getCurrentEventState()->setX(x);
|
||||
_kbmcb->getEventQueue()->getCurrentEventState()->setY(y);
|
||||
_kbmcb->getKeyboardMouse()->positionPointer(x,y);
|
||||
return;
|
||||
}
|
||||
|
||||
66
src/osgWrappers/osgGA/EventQueue.cpp
Normal file
66
src/osgWrappers/osgGA/EventQueue.cpp
Normal file
@@ -0,0 +1,66 @@
|
||||
// ***************************************************************************
|
||||
//
|
||||
// Generated automatically by genwrapper.
|
||||
// Please DO NOT EDIT this file!
|
||||
//
|
||||
// ***************************************************************************
|
||||
|
||||
#include <osgIntrospection/ReflectionMacros>
|
||||
#include <osgIntrospection/TypedMethodInfo>
|
||||
#include <osgIntrospection/Attributes>
|
||||
|
||||
#include <osg/Timer>
|
||||
#include <osgGA/EventQueue>
|
||||
#include <osgGA/GUIEventAdapter>
|
||||
|
||||
// Must undefine IN and OUT macros defined in Windows headers
|
||||
#ifdef IN
|
||||
#undef IN
|
||||
#endif
|
||||
#ifdef OUT
|
||||
#undef OUT
|
||||
#endif
|
||||
|
||||
TYPE_NAME_ALIAS(std::list< osg::ref_ptr< osgGA::GUIEventAdapter > >, osgGA::EventQueue::Events);
|
||||
|
||||
BEGIN_OBJECT_REFLECTOR(osgGA::EventQueue)
|
||||
I_BaseType(osg::Referenced);
|
||||
I_Constructor0();
|
||||
I_Method1(void, setEvents, IN, osgGA::EventQueue::Events &, events);
|
||||
I_Method1(bool, takeEvents, IN, osgGA::EventQueue::Events &, events);
|
||||
I_Method1(bool, copyEvents, IN, osgGA::EventQueue::Events &, events);
|
||||
I_Method1(void, appendEvents, IN, osgGA::EventQueue::Events &, events);
|
||||
I_Method1(void, addEvent, IN, osgGA::GUIEventAdapter *, event);
|
||||
I_Method4(void, windowResize, IN, float, Xmin, IN, float, Ymin, IN, float, Xmax, IN, float, Ymax);
|
||||
I_Method1(void, mouseScroll, IN, osgGA::GUIEventAdapter::ScrollingMotion, sm);
|
||||
I_Method2(void, mouseMotion, IN, float, x, IN, float, y);
|
||||
I_Method3(void, mouseButtonPress, IN, float, x, IN, float, y, IN, unsigned int, button);
|
||||
I_Method3(void, mouseButtonRelease, IN, float, x, IN, float, y, IN, unsigned int, button);
|
||||
I_Method1(void, keyPress, IN, osgGA::GUIEventAdapter::KeySymbol, key);
|
||||
I_Method1(void, keyRelease, IN, osgGA::GUIEventAdapter::KeySymbol, key);
|
||||
I_Method1(void, frame, IN, double, t);
|
||||
I_Method1(void, setStartTick, IN, osg::Timer_t, tick);
|
||||
I_Method0(osg::Timer_t, getStartTick);
|
||||
I_Method0(double, getTime);
|
||||
I_Method0(osgGA::GUIEventAdapter *, getCurrentEventState);
|
||||
I_Method0(const osgGA::GUIEventAdapter *, getCurrentEventState);
|
||||
I_ReadOnlyProperty(osgGA::GUIEventAdapter *, CurrentEventState);
|
||||
I_WriteOnlyProperty(osgGA::EventQueue::Events &, Events);
|
||||
I_Property(osg::Timer_t, StartTick);
|
||||
I_ReadOnlyProperty(double, Time);
|
||||
END_REFLECTOR
|
||||
|
||||
BEGIN_VALUE_REFLECTOR(osg::ref_ptr< osgGA::GUIEventAdapter >)
|
||||
I_Constructor0();
|
||||
I_Constructor1(IN, osgGA::GUIEventAdapter *, t);
|
||||
I_Constructor1(IN, const osg::ref_ptr< osgGA::GUIEventAdapter > &, rp);
|
||||
I_Method0(bool, valid);
|
||||
I_Method0(osgGA::GUIEventAdapter *, get);
|
||||
I_Method0(const osgGA::GUIEventAdapter *, get);
|
||||
I_Method0(osgGA::GUIEventAdapter *, take);
|
||||
I_Method0(osgGA::GUIEventAdapter *, release);
|
||||
I_ReadOnlyProperty(osgGA::GUIEventAdapter *, );
|
||||
END_REFLECTOR
|
||||
|
||||
STD_LIST_REFLECTOR(std::list< osg::ref_ptr< osgGA::GUIEventAdapter > >);
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
#include <osg/Projection>
|
||||
#include <osg/Switch>
|
||||
#include <osg/Transform>
|
||||
#include <osgGA/EventQueue>
|
||||
#include <osgGA/EventVisitor>
|
||||
#include <osgGA/GUIActionAdapter>
|
||||
#include <osgGA/GUIEventAdapter>
|
||||
@@ -39,13 +40,13 @@ BEGIN_OBJECT_REFLECTOR(osgGA::EventVisitor)
|
||||
I_Method1(void, setActionAdapter, IN, osgGA::GUIActionAdapter *, actionAdapter);
|
||||
I_Method0(osgGA::GUIActionAdapter *, getActionAdapter);
|
||||
I_Method0(const osgGA::GUIActionAdapter *, getActionAdapter);
|
||||
I_Method1(void, setEventList, IN, const osgGA::EventVisitor::EventList &, events);
|
||||
I_Method0(osgGA::EventVisitor::EventList &, getEventList);
|
||||
I_Method0(const osgGA::EventVisitor::EventList &, getEventList);
|
||||
I_Method1(void, addEvent, IN, osgGA::GUIEventAdapter *, event);
|
||||
I_Method1(void, removeEvent, IN, osgGA::GUIEventAdapter *, event);
|
||||
I_Method0(bool, getEventHandled);
|
||||
I_Method1(void, setEventHandled, IN, bool, handled);
|
||||
I_Method0(bool, getEventHandled);
|
||||
I_Method1(void, setEvents, IN, const osgGA::EventQueue::Events &, events);
|
||||
I_Method0(osgGA::EventQueue::Events &, getEvents);
|
||||
I_Method0(const osgGA::EventQueue::Events &, getEvents);
|
||||
I_Method0(void, reset);
|
||||
I_Method1(void, apply, IN, osg::Node &, node);
|
||||
I_Method1(void, apply, IN, osg::Geode &, node);
|
||||
@@ -59,20 +60,6 @@ BEGIN_OBJECT_REFLECTOR(osgGA::EventVisitor)
|
||||
I_Method1(void, apply, IN, osg::OccluderNode &, node);
|
||||
I_Property(osgGA::GUIActionAdapter *, ActionAdapter);
|
||||
I_Property(bool, EventHandled);
|
||||
I_Property(const osgGA::EventVisitor::EventList &, EventList);
|
||||
I_Property(const osgGA::EventQueue::Events &, Events);
|
||||
END_REFLECTOR
|
||||
|
||||
BEGIN_VALUE_REFLECTOR(osg::ref_ptr< osgGA::GUIEventAdapter >)
|
||||
I_Constructor0();
|
||||
I_Constructor1(IN, osgGA::GUIEventAdapter *, t);
|
||||
I_Constructor1(IN, const osg::ref_ptr< osgGA::GUIEventAdapter > &, rp);
|
||||
I_Method0(bool, valid);
|
||||
I_Method0(osgGA::GUIEventAdapter *, get);
|
||||
I_Method0(const osgGA::GUIEventAdapter *, get);
|
||||
I_Method0(osgGA::GUIEventAdapter *, take);
|
||||
I_Method0(osgGA::GUIEventAdapter *, release);
|
||||
I_ReadOnlyProperty(osgGA::GUIEventAdapter *, );
|
||||
END_REFLECTOR
|
||||
|
||||
STD_LIST_REFLECTOR(std::list< osg::ref_ptr< osgGA::GUIEventAdapter > >);
|
||||
|
||||
|
||||
@@ -4,6 +4,8 @@ include $(TOPDIR)/Make/makedefs
|
||||
CXXFILES =\
|
||||
AnimationPathManipulator.cpp\
|
||||
DriveManipulator.cpp\
|
||||
Event.cpp\
|
||||
EventQueue.cpp\
|
||||
EventVisitor.cpp\
|
||||
FlightManipulator.cpp\
|
||||
GUIActionAdapter.cpp\
|
||||
|
||||
@@ -36,10 +36,7 @@ BEGIN_ENUM_REFLECTOR(osgGA::GUIEventAdapter::EventType)
|
||||
I_EnumLabel(osgGA::GUIEventAdapter::KEYUP);
|
||||
I_EnumLabel(osgGA::GUIEventAdapter::FRAME);
|
||||
I_EnumLabel(osgGA::GUIEventAdapter::RESIZE);
|
||||
I_EnumLabel(osgGA::GUIEventAdapter::SCROLLUP);
|
||||
I_EnumLabel(osgGA::GUIEventAdapter::SCROLLDOWN);
|
||||
I_EnumLabel(osgGA::GUIEventAdapter::SCROLLLEFT);
|
||||
I_EnumLabel(osgGA::GUIEventAdapter::SCROLLRIGHT);
|
||||
I_EnumLabel(osgGA::GUIEventAdapter::SCROLL);
|
||||
END_REFLECTOR
|
||||
|
||||
BEGIN_ENUM_REFLECTOR(osgGA::GUIEventAdapter::KeySymbol)
|
||||
@@ -189,37 +186,64 @@ BEGIN_ENUM_REFLECTOR(osgGA::GUIEventAdapter::MouseYOrientation)
|
||||
I_EnumLabel(osgGA::GUIEventAdapter::Y_INCREASING_DOWNWARDS);
|
||||
END_REFLECTOR
|
||||
|
||||
BEGIN_ABSTRACT_OBJECT_REFLECTOR(osgGA::GUIEventAdapter)
|
||||
BEGIN_ENUM_REFLECTOR(osgGA::GUIEventAdapter::ScrollingMotion)
|
||||
I_EnumLabel(osgGA::GUIEventAdapter::SCROLL_LEFT);
|
||||
I_EnumLabel(osgGA::GUIEventAdapter::SCROLL_RIGHT);
|
||||
I_EnumLabel(osgGA::GUIEventAdapter::SCROLL_UP);
|
||||
I_EnumLabel(osgGA::GUIEventAdapter::SCROLL_DOWN);
|
||||
END_REFLECTOR
|
||||
|
||||
BEGIN_OBJECT_REFLECTOR(osgGA::GUIEventAdapter)
|
||||
I_BaseType(osg::Referenced);
|
||||
I_Constructor0();
|
||||
I_Constructor1(IN, const osgGA::GUIEventAdapter &, rhs);
|
||||
I_Method1(void, setEventType, IN, osgGA::GUIEventAdapter::EventType, Type);
|
||||
I_Method0(osgGA::GUIEventAdapter::EventType, getEventType);
|
||||
I_Method0(int, getKey);
|
||||
I_Method0(int, getButton);
|
||||
I_Method1(void, setMouseYOrientation, IN, osgGA::GUIEventAdapter::MouseYOrientation, myo);
|
||||
I_Method0(osgGA::GUIEventAdapter::MouseYOrientation, getMouseYOrientation);
|
||||
I_Method0(float, getXmin);
|
||||
I_Method0(float, getXmax);
|
||||
I_Method0(float, getYmin);
|
||||
I_Method0(float, getYmax);
|
||||
I_Method0(float, getX);
|
||||
I_Method0(float, getY);
|
||||
I_Method0(unsigned int, getButtonMask);
|
||||
I_Method0(unsigned int, getModKeyMask);
|
||||
I_Method1(void, setTime, IN, double, time);
|
||||
I_Method0(double, getTime);
|
||||
I_Method0(double, time);
|
||||
I_Method1(void, setKey, IN, int, key);
|
||||
I_Method0(int, getKey);
|
||||
I_Method1(void, setButton, IN, int, button);
|
||||
I_Method0(int, getButton);
|
||||
I_Method4(void, setWindowSize, IN, float, Xmin, IN, float, Ymin, IN, float, Xmax, IN, float, Ymax);
|
||||
I_Method1(void, setXmin, IN, float, x);
|
||||
I_Method0(float, getXmin);
|
||||
I_Method1(void, setXmax, IN, float, x);
|
||||
I_Method0(float, getXmax);
|
||||
I_Method1(void, setYmin, IN, float, y);
|
||||
I_Method0(float, getYmin);
|
||||
I_Method1(void, setYmax, IN, float, y);
|
||||
I_Method0(float, getYmax);
|
||||
I_Method1(void, setX, IN, float, x);
|
||||
I_Method0(float, getX);
|
||||
I_Method1(void, setY, IN, float, y);
|
||||
I_Method0(float, getY);
|
||||
I_Method1(void, setButtonMask, IN, unsigned int, mask);
|
||||
I_Method0(unsigned int, getButtonMask);
|
||||
I_Method1(void, setModKeyMask, IN, unsigned int, mask);
|
||||
I_Method0(unsigned int, getModKeyMask);
|
||||
I_Method1(void, setScrollingMotion, IN, osgGA::GUIEventAdapter::ScrollingMotion, motion);
|
||||
I_Method0(osgGA::GUIEventAdapter::ScrollingMotion, getScrollingMotion);
|
||||
I_Method0(float, getXnormalized);
|
||||
I_Method0(float, getYnormalized);
|
||||
I_ReadOnlyProperty(int, Button);
|
||||
I_ReadOnlyProperty(unsigned int, ButtonMask);
|
||||
I_ReadOnlyProperty(osgGA::GUIEventAdapter::EventType, EventType);
|
||||
I_ReadOnlyProperty(int, Key);
|
||||
I_ReadOnlyProperty(unsigned int, ModKeyMask);
|
||||
I_Method1(void, setMouseYOrientation, IN, osgGA::GUIEventAdapter::MouseYOrientation, myo);
|
||||
I_Method0(osgGA::GUIEventAdapter::MouseYOrientation, getMouseYOrientation);
|
||||
I_Property(int, Button);
|
||||
I_Property(unsigned int, ButtonMask);
|
||||
I_Property(osgGA::GUIEventAdapter::EventType, EventType);
|
||||
I_Property(int, Key);
|
||||
I_Property(unsigned int, ModKeyMask);
|
||||
I_Property(osgGA::GUIEventAdapter::MouseYOrientation, MouseYOrientation);
|
||||
I_ReadOnlyProperty(float, X);
|
||||
I_ReadOnlyProperty(float, Xmax);
|
||||
I_ReadOnlyProperty(float, Xmin);
|
||||
I_Property(osgGA::GUIEventAdapter::ScrollingMotion, ScrollingMotion);
|
||||
I_Property(double, Time);
|
||||
I_Property(float, X);
|
||||
I_Property(float, Xmax);
|
||||
I_Property(float, Xmin);
|
||||
I_ReadOnlyProperty(float, Xnormalized);
|
||||
I_ReadOnlyProperty(float, Y);
|
||||
I_ReadOnlyProperty(float, Ymax);
|
||||
I_ReadOnlyProperty(float, Ymin);
|
||||
I_Property(float, Y);
|
||||
I_Property(float, Ymax);
|
||||
I_Property(float, Ymin);
|
||||
I_ReadOnlyProperty(float, Ynormalized);
|
||||
END_REFLECTOR
|
||||
|
||||
|
||||
@@ -1,64 +0,0 @@
|
||||
// ***************************************************************************
|
||||
//
|
||||
// Generated automatically by genwrapper.
|
||||
// Please DO NOT EDIT this file!
|
||||
//
|
||||
// ***************************************************************************
|
||||
|
||||
#include <osgIntrospection/ReflectionMacros>
|
||||
#include <osgIntrospection/TypedMethodInfo>
|
||||
#include <osgIntrospection/Attributes>
|
||||
|
||||
#include <osgGA/GUIEventAdapter>
|
||||
#include <osgProducer/EventAdapter>
|
||||
|
||||
// Must undefine IN and OUT macros defined in Windows headers
|
||||
#ifdef IN
|
||||
#undef IN
|
||||
#endif
|
||||
#ifdef OUT
|
||||
#undef OUT
|
||||
#endif
|
||||
|
||||
BEGIN_OBJECT_REFLECTOR(osgProducer::EventAdapter)
|
||||
I_BaseType(osgGA::GUIEventAdapter);
|
||||
I_Constructor0();
|
||||
I_Method0(osgGA::GUIEventAdapter::EventType, getEventType);
|
||||
I_Method1(void, setKey, IN, int, key);
|
||||
I_Method0(int, getKey);
|
||||
I_Method0(int, getButton);
|
||||
I_Method0(float, getXmin);
|
||||
I_Method0(float, getXmax);
|
||||
I_Method0(float, getYmin);
|
||||
I_Method0(float, getYmax);
|
||||
I_Method1(void, setX, IN, float, x);
|
||||
I_Method0(float, getX);
|
||||
I_Method1(void, setY, IN, float, y);
|
||||
I_Method0(float, getY);
|
||||
I_Method1(void, setButtonMak, IN, unsigned int, mask);
|
||||
I_Method0(unsigned int, getButtonMask);
|
||||
I_Method0(double, time);
|
||||
I_Method0(unsigned int, getModKeyMask);
|
||||
I_Method5(void, adaptResize, IN, double, t, IN, float, Xmin, IN, float, Ymin, IN, float, Xmax, IN, float, Ymax);
|
||||
I_Method2(void, adaptMouseScroll, IN, double, t, IN, Producer::KeyboardMouseCallback::ScrollingMotion, sm);
|
||||
I_Method3(void, adaptMouseMotion, IN, double, t, IN, float, x, IN, float, y);
|
||||
I_Method4(void, adaptButtonPress, IN, double, t, IN, float, x, IN, float, y, IN, unsigned int, button);
|
||||
I_Method4(void, adaptButtonRelease, IN, double, t, IN, float, x, IN, float, y, IN, unsigned int, button);
|
||||
I_Method2(void, adaptKeyPress, IN, double, t, IN, Producer::KeySymbol, key);
|
||||
I_Method2(void, adaptKeyRelease, IN, double, t, IN, Producer::KeySymbol, key);
|
||||
I_Method1(void, adaptFrame, IN, double, t);
|
||||
I_Method0(void, copyStaticVariables);
|
||||
I_ReadOnlyProperty(int, Button);
|
||||
I_WriteOnlyProperty(unsigned int, ButtonMak);
|
||||
I_ReadOnlyProperty(unsigned int, ButtonMask);
|
||||
I_ReadOnlyProperty(osgGA::GUIEventAdapter::EventType, EventType);
|
||||
I_Property(int, Key);
|
||||
I_ReadOnlyProperty(unsigned int, ModKeyMask);
|
||||
I_Property(float, X);
|
||||
I_ReadOnlyProperty(float, Xmax);
|
||||
I_ReadOnlyProperty(float, Xmin);
|
||||
I_Property(float, Y);
|
||||
I_ReadOnlyProperty(float, Ymax);
|
||||
I_ReadOnlyProperty(float, Ymin);
|
||||
END_REFLECTOR
|
||||
|
||||
@@ -2,7 +2,7 @@ TOPDIR = ../../..
|
||||
include $(TOPDIR)/Make/makedefs
|
||||
|
||||
CXXFILES =\
|
||||
EventAdapter.cpp\
|
||||
Export.cpp\
|
||||
GraphicsContextImplementation.cpp\
|
||||
KeyboardMouseCallback.cpp\
|
||||
OsgCameraGroup.cpp\
|
||||
|
||||
@@ -9,8 +9,8 @@
|
||||
#include <osgIntrospection/TypedMethodInfo>
|
||||
#include <osgIntrospection/Attributes>
|
||||
|
||||
#include <osg/Timer>
|
||||
#include <osgProducer/EventAdapter>
|
||||
#include <osgGA/EventQueue>
|
||||
#include <osgGA/GUIEventAdapter>
|
||||
#include <osgProducer/KeyboardMouseCallback>
|
||||
|
||||
// Must undefine IN and OUT macros defined in Windows headers
|
||||
@@ -21,7 +21,7 @@
|
||||
#undef OUT
|
||||
#endif
|
||||
|
||||
TYPE_NAME_ALIAS(std::vector< osg::ref_ptr< osgProducer::EventAdapter > >, osgProducer::KeyboardMouseCallback::EventQueue);
|
||||
TYPE_NAME_ALIAS(osgGA::EventQueue::Events, osgProducer::KeyboardMouseCallback::EventQueue);
|
||||
|
||||
BEGIN_OBJECT_REFLECTOR(osgProducer::KeyboardMouseCallback)
|
||||
I_ConstructorWithDefaults3(IN, Producer::KeyboardMouse *, keyboardMouse, , IN, bool &, done, , IN, bool, escapeKeySetsDone, true);
|
||||
@@ -40,38 +40,20 @@ BEGIN_OBJECT_REFLECTOR(osgProducer::KeyboardMouseCallback)
|
||||
I_Method0(void, shutdown);
|
||||
I_Method1(void, setEscapeSetDone, IN, bool, esc);
|
||||
I_Method0(bool, getEscapeSetDone);
|
||||
I_Method1(double, getEventQueue, IN, osgProducer::KeyboardMouseCallback::EventQueue &, queue);
|
||||
I_Method1(double, copyEventQueue, IN, osgProducer::KeyboardMouseCallback::EventQueue &, queue);
|
||||
I_Method1(double, setEventQueue, IN, osgProducer::KeyboardMouseCallback::EventQueue &, queue);
|
||||
I_Method1(double, appendEventQueue, IN, osgProducer::KeyboardMouseCallback::EventQueue &, queue);
|
||||
I_Method0(osgGA::EventQueue *, getEventQueue);
|
||||
I_Method1(bool, takeEventQueue, IN, osgProducer::KeyboardMouseCallback::EventQueue &, queue);
|
||||
I_Method1(bool, copyEventQueue, IN, osgProducer::KeyboardMouseCallback::EventQueue &, queue);
|
||||
I_Method1(void, setEventQueue, IN, osgProducer::KeyboardMouseCallback::EventQueue &, queue);
|
||||
I_Method1(void, appendEventQueue, IN, osgProducer::KeyboardMouseCallback::EventQueue &, queue);
|
||||
I_Method0(bool, done);
|
||||
I_Method0(float, mx);
|
||||
I_Method0(float, my);
|
||||
I_Method0(unsigned int, mbutton);
|
||||
I_Method1(void, setStartTick, IN, osg::Timer_t, tick);
|
||||
I_Method0(osg::Timer_t, getStartTick);
|
||||
I_Method0(double, getTime);
|
||||
I_Method0(Producer::KeyboardMouse *, getKeyboardMouse);
|
||||
I_Method0(const Producer::KeyboardMouse *, getKeyboardMouse);
|
||||
I_Method0(osgProducer::EventAdapter *, createEventAdapter);
|
||||
I_Method0(osgGA::GUIEventAdapter *, createEventAdapter);
|
||||
I_Method0(void, updateWindowSize);
|
||||
I_Property(bool, EscapeSetDone);
|
||||
I_WriteOnlyPropertyWithReturnType(osgProducer::KeyboardMouseCallback::EventQueue &, EventQueue, double);
|
||||
I_ReadOnlyProperty(osgGA::EventQueue *, EventQueue);
|
||||
I_ReadOnlyProperty(Producer::KeyboardMouse *, KeyboardMouse);
|
||||
I_Property(osg::Timer_t, StartTick);
|
||||
I_ReadOnlyProperty(double, Time);
|
||||
END_REFLECTOR
|
||||
|
||||
BEGIN_VALUE_REFLECTOR(osg::ref_ptr< osgProducer::EventAdapter >)
|
||||
I_Constructor0();
|
||||
I_Constructor1(IN, osgProducer::EventAdapter *, t);
|
||||
I_Constructor1(IN, const osg::ref_ptr< osgProducer::EventAdapter > &, rp);
|
||||
I_Method0(bool, valid);
|
||||
I_Method0(osgProducer::EventAdapter *, get);
|
||||
I_Method0(const osgProducer::EventAdapter *, get);
|
||||
I_Method0(osgProducer::EventAdapter *, take);
|
||||
I_Method0(osgProducer::EventAdapter *, release);
|
||||
I_ReadOnlyProperty(osgProducer::EventAdapter *, );
|
||||
END_REFLECTOR
|
||||
|
||||
STD_VECTOR_REFLECTOR(std::vector< osg::ref_ptr< osgProducer::EventAdapter > >);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user