OpenCOVER
coMousePointer.h
Go to the documentation of this file.
1/* This file is part of COVISE.
2
3 You can use it under the terms of the GNU Lesser General Public License
4 version 2.1 or later, see lgpl-2.1.txt.
5
6 * License: LGPL 2+ */
7
8/************************************************************************
9 * *
10 * *
11 * (C) 2001 *
12 * Computer Centre University of Stuttgart *
13 * Allmandring 30 *
14 * D-70550 Stuttgart *
15 * Germany *
16 * *
17 * *
18 * File coMousePointer.h (Performer 2.0) *
19 * *
20 * Description Mouse support for COVER
21 * *
22 * Author Uwe Woessner *
23 * *
24 * Date 19.09.2001 *
25 * *
26 * Status none *
27 * *
28 ************************************************************************/
29
30#ifndef MOUSE_POINTER_H
31#define MOUSE_POINTER_H
32
33#include <util/common.h>
34#include <osg/Matrix>
35
36namespace opencover
37{
38
39class ButtonDevice;
40class TrackingBody;
41
43{
45};
46
47class COVEREXPORT coMousePointer
48{
49 friend class Input;
50
51private:
54
55 float width, height;
56 int xres, yres, xori, yori;
57 float screenX, screenY, screenZ;
58 float screenH, screenP, screenR;
59
60 int wheelCounter[2], newWheelCounter[2]; // vertical and horizontal
61 float mouseX, mouseY;
62 typedef std::deque<MouseEvent> EventQueue;
63 EventQueue eventQueue;
64 double mouseTime, mouseButtonTime;
65 void queueEvent(int type, int state, int code);
66 void processEvents();
67
68 ButtonDevice *buttons = nullptr;
69 TrackingBody *body = nullptr;
70 bool buttonPressed = false;
71
72public:
73 // frame time of last mouse event
74 double eventTime() const;
75
76 // process mouse events
77 void handleEvent(int type, int state, int code, bool queue = true);
78
79 void update();
80#if 0
81 void setMatrix(const osg::Matrix &mat);
82#endif
83 const osg::Matrix &getMatrix() const;
84
86 float x() const;
87
89 float y() const;
90
92 float winWidth() const;
93
95 float winHeight() const;
96
98 float screenWidth() const;
99
101 float screenHeight() const;
102
103 int wheel(size_t num = 0) const;
104
105 unsigned int buttonState() const;
106};
107}
108#endif
Definition: ARToolKit.h:33
Definition: buttondevice.h:28
Definition: coMousePointer.h:43
int state
Definition: coMousePointer.h:44
int code
Definition: coMousePointer.h:44
int type
Definition: coMousePointer.h:44
Definition: coMousePointer.h:48
void handleEvent(int type, int state, int code, bool queue=true)
float x() const
current mouse screen x coordinate
int wheel(size_t num=0) const
float winHeight() const
height of window where mouse events are tracked
float y() const
current mouse screen y coordinate
unsigned int buttonState() const
float screenWidth() const
width of screen where mouse events are tracked
double eventTime() const
float winWidth() const
width of window where mouse events are tracked
const osg::Matrix & getMatrix() const
float screenHeight() const
height of screen where mouse events are tracked
The Input class.
Definition: input.h:40
Definition: trackingbody.h:29