Files
OpenSceneGraph/include/osgProducer/EventAdapter

90 lines
2.9 KiB
C++

/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2005 Robert Osfield
*
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* OpenSceneGraph Public License for more details.
*/
#ifndef OSGGLUT_ProducerEventAdapter
#define OSGGLUT_ProducerEventAdapter 1
#include <osgProducer/Export>
#include <osgGA/GUIEventAdapter>
#include <Producer/KeyboardMouse>
namespace osgProducer {
/** Class for adapting Producer events so that they can be used as input to osgGA::CameraManipulators.*/
class OSGPRODUCER_EXPORT EventAdapter : public osgGA::GUIEventAdapter
{
public:
EventAdapter();
virtual ~EventAdapter() {}
/** static method for setting window dimensions.*/
static void setWindowSize(float Xmin, float Ymin, float Xmax, float Ymax);
/** static method for setting button state.*/
static void setButtonMask(unsigned int buttonMask);
/** method for adapting resize events. */
void adaptResize(double t, float Xmin, float Ymin, float Xmax, float Ymax);
/** method for adapting mouse scroll wheel events. */
void adaptMouseScroll(double t, Producer::KeyboardMouseCallback::ScrollingMotion sm);
/** method for adapting mouse motion events whilst mouse buttons are pressed.*/
void adaptMouseMotion(double t, float x, float y);
void adaptButtonPress(double t,float x, float y, unsigned int button);
void adaptButtonRelease(double t,float x, float y, unsigned int button);
/** method for adapting keyboard events.*/
void adaptKeyPress( double t, Producer::KeySymbol key);
void adaptKeyRelease( double t, Producer::KeySymbol key);
/** method for adapting frame events, i.e. idle/display callback.*/
void adaptFrame(double t);
void copyStaticVariables();
public:
// used to accumulate the button mask state, it represents
// the current button mask state, which is modified by the
// adaptMouse() method which then copies it to value _buttonMask
// which required the mouse buttons state at the time of the event.
static unsigned int _s_accumulatedButtonMask;
// used to store current button value
static int _s_button;
// used to store window min and max values.
static float _s_Xmin;
static float _s_Xmax;
static float _s_Ymin;
static float _s_Ymax;
static float _s_mx;
static float _s_my;
static int _s_modKeyMask;
};
}
#endif