Panda3D

graphicsWindowInputDevice.I
Go to the documentation of this file.
1 /**
2 * PANDA 3D SOFTWARE
3 * Copyright (c) Carnegie Mellon University. All rights reserved.
4 *
5 * All use of this software is subject to the terms of the revised BSD
6 * license. You should have received a copy of this license along
7 * with this source code in a file named "LICENSE."
8 *
9 * @file graphicsWindowInputDevice.I
10 * @author drose
11 * @date 2000-05-24
12 */
13
14 /**
15 * Returns the PointerData associated with the input device's pointer. This
16 * only makes sense if has_pointer() also returns true.
17 */
18 INLINE PointerData GraphicsWindowInputDevice::
19 get_pointer() const {
20 LightMutexHolder holder(_lock);
21 if (!_pointers.empty()) {
22 return _pointers[0];
23 } else {
24 return PointerData();
25 }
26 }
27
28 /**
29 * To be called by a particular kind of GraphicsWindow to indicate that the
30 * pointer data has changed.
31 */
32 INLINE void GraphicsWindowInputDevice::
33 update_pointer(PointerData data, double time) {
34 LightMutexHolder holder(_lock);
35 InputDevice::update_pointer(std::move(data), time);
36 }
37
38 /**
39 * To be called by a particular kind of GraphicsWindow to indicate that the
40 * pointer has moved by the given relative amount.
41 */
42 INLINE void GraphicsWindowInputDevice::
43 pointer_moved(double x, double y, double time) {
44 LightMutexHolder holder(_lock);
45 InputDevice::pointer_moved(0, x, y, time);
46 }
47
48 /**
49 * To be called by a particular kind of GraphicsWindow to indicate that the
50 * pointer no longer exists.
51 */
52 INLINE void GraphicsWindowInputDevice::
53 remove_pointer(int id) {
54 LightMutexHolder holder(_lock);
55 InputDevice::remove_pointer(id);
56 }
GraphicsWindowInputDevice::pointer_moved
void pointer_moved(double x, double y, double time=ClockObject::get_global_clock() ->get_frame_time())
To be called by a particular kind of GraphicsWindow to indicate that the pointer has moved by the giv...
Definition: graphicsWindowInputDevice.I:43
GraphicsWindowInputDevice::get_pointer
PointerData get_pointer() const
Returns the PointerData associated with the input device's pointer.
Definition: graphicsWindowInputDevice.I:19
GraphicsWindowInputDevice::remove_pointer
void remove_pointer(int id)
To be called by a particular kind of GraphicsWindow to indicate that the pointer no longer exists.
Definition: graphicsWindowInputDevice.I:53
GraphicsWindowInputDevice::update_pointer
void update_pointer(PointerData data, double time=ClockObject::get_global_clock() ->get_frame_time())
To be called by a particular kind of GraphicsWindow to indicate that the pointer data has changed.
Definition: graphicsWindowInputDevice.I:33
LightMutexHolder
Similar to MutexHolder, but for a light mutex.
Definition: lightMutexHolder.h:25
PointerData
Holds the data that might be generated by a 2-d pointer input device, such as the mouse in the Graphi...
Definition: pointerData.h:38