Panda3D
Loading...
Searching...
No Matches
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 */
19get_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 */
33update_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 */
43pointer_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 */
53remove_pointer(int id) {
54 LightMutexHolder holder(_lock);
55 InputDevice::remove_pointer(id);
56}
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...
PointerData get_pointer() const
Returns the PointerData associated with the input device's pointer.
void remove_pointer(int id)
To be called by a particular kind of GraphicsWindow to indicate that the pointer no longer exists.
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.
Similar to MutexHolder, but for a light mutex.
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