GlutMouseDevice Class Reference
Simple glut based mouse device. More...
#include <GlutMouseDevice.h>
Inherits InputDeviceBase.

Public Member Functions | |
| GlutMouseDevice (float axisReleaseSpeed) | |
| virtual | ~GlutMouseDevice () |
| virtual void | update () |
Static Public Member Functions | |
| static void | cbGlutMouse (int button, int state, int x, int y) |
| static void | cbGlutMouseMove (int x, int y) |
| static void | setWindowSize (int width, int height) |
| static void | setMouseGrabbing (bool on) |
Static Public Attributes | |
| static const float | DefaultAxisReleaseSpeed = 20.f |
Private Member Functions | |
| void | setButtonState (unsigned int buttonIndex, int value) |
| void | handleAxesChange (float deltaX, float deltaY) |
| void | resetAxes () |
Private Attributes | |
| float | axisWriteTimeStamp [2] |
| float | oldPos [2] |
| bool | oldPosRead [2] |
| float | axisReleaseSpeed |
Static Private Attributes | |
| static float | winWidth = -1 |
| static float | winHeight = -1 |
| static float | screenWidth = 0 |
| static float | screenHeight = 0 |
| static bool | grabMouse = true |
| static std::vector < GlutMouseDevice * > | activeDevices |
Detailed Description
Simple glut based mouse device.usage: call setWindowSize() to tell the mouse controller the initial window size create one instance of the glut mouse controller call static method cbGlutMouse() in glutMouseFunc() callback call static method cbGlutMouseMove() in glut glutMotionFunc() AND glutPassiveMotionFunc() callback call setWindowSize() whenever the window size changes (i.e. in glutReshapeFunc() callback)
Constructor & Destructor Documentation
| GlutMouseDevice::GlutMouseDevice | ( | float | axisReleaseSpeed | ) |
Constructor. The passed variable axisReleaseSpeed defines how fast the axis value is released to zero. If you set this speed to high you may get bumpy navigation results, if it is too low the axis will drift
| GlutMouseDevice::~GlutMouseDevice | ( | ) | [virtual] |
Destructor
Member Function Documentation
| void GlutMouseDevice::cbGlutMouse | ( | int | button, | |
| int | state, | |||
| int | x, | |||
| int | y | |||
| ) | [static] |
Static GLUT callback for mouse button click (or release)
| void GlutMouseDevice::cbGlutMouseMove | ( | int | x, | |
| int | y | |||
| ) | [static] |
Static GLUT callback for mouse motion
| void GlutMouseDevice::handleAxesChange | ( | float | deltaX, | |
| float | deltaY | |||
| ) | [private] |
Copes with mouse axis changes. This method is called by the cbGlutMouseMove method and gets the (normalized) offsets in X and Y direction of the mouse pointer. Out of this it calculates the new mouse axis values.
| void GlutMouseDevice::resetAxes | ( | ) | [private] |
Resets the axes values to zero. This method is called whenever the window size is changed
| void GlutMouseDevice::setButtonState | ( | unsigned int | buttonIndex, | |
| int | value | |||
| ) | [private] |
Sets the button state for the passed index to the value
| void GlutMouseDevice::setMouseGrabbing | ( | bool | on | ) | [static] |
Defines wether the mouse is grabbed in the window or not. If the mouse is grabbed it won't be visible and will be fixed inside the window. By deactivating mouse grabbing the mouse gets visible again and can be moved freely again.
| void GlutMouseDevice::setWindowSize | ( | int | width, | |
| int | height | |||
| ) | [static] |
Static GLUT callback for resizing the window size
| void GlutMouseDevice::update | ( | ) | [virtual] |
The method updates the axis value according to the set release speed. It therefore measures the time between the last mouse position callback and the current time and linearly interpolates between the last pointer position and zero taking into accound the speed value.
Reimplemented from InputDeviceBase.
Member Data Documentation
std::vector< GlutMouseDevice * > GlutMouseDevice::activeDevices [static, private] |
float GlutMouseDevice::axisReleaseSpeed [private] |
float GlutMouseDevice::axisWriteTimeStamp[2] [private] |
const float GlutMouseDevice::DefaultAxisReleaseSpeed = 20.f [static] |
bool GlutMouseDevice::grabMouse = true [static, private] |
float GlutMouseDevice::oldPos[2] [private] |
bool GlutMouseDevice::oldPosRead[2] [private] |
float GlutMouseDevice::screenHeight = 0 [static, private] |
float GlutMouseDevice::screenWidth = 0 [static, private] |
float GlutMouseDevice::winHeight = -1 [static, private] |
float GlutMouseDevice::winWidth = -1 [static, private] |
The documentation for this class was generated from the following files:
- src/inVRs/InputInterface/ControllerManager/GlutMouseDevice.h
- src/inVRs/InputInterface/ControllerManager/GlutMouseDevice.cpp
Generated on Wed Oct 20 16:11:56 2010 for inVRs by
1.5.8