Panda3D
inputDeviceManager.h
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 inputDeviceManager.h
10  * @author rdb
11  * @date 2015-12-09
12  */
13 
14 #ifndef INPUTDEVICEMANAGER_H
15 #define INPUTDEVICEMANAGER_H
16 
17 #include "pandabase.h"
18 #include "lightMutex.h"
19 #include "inputDevice.h"
20 #include "inputDeviceSet.h"
21 
22 #ifdef _WIN32
23 #include "xInputDevice.h"
24 class WinRawInputDevice;
25 #endif
26 
27 /**
28  * This class keeps track of all the devices on a system, and sends out events
29  * when a device has been hot-plugged.
30  */
31 class EXPCL_PANDA_DEVICE InputDeviceManager {
32 protected:
34  ~InputDeviceManager() = default;
35 
36  static void make_global_ptr();
37 
38 PUBLISHED:
39  InputDeviceSet get_devices() const;
40  InputDeviceSet get_devices(InputDevice::DeviceClass device_class) const;
41 
42  void add_device(InputDevice *device);
43  void remove_device(InputDevice *device);
44 
45  virtual void update();
46 
47  INLINE static InputDeviceManager *get_global_ptr();
48 
49 protected:
50  LightMutex _lock;
51 
52 #ifdef PHAVE_LINUX_INPUT_H
53  InputDeviceSet _inactive_devices;
54 #endif
55 
56  InputDeviceSet _connected_devices;
57 
58  static InputDeviceManager *_global_ptr;
59 };
60 
61 #include "inputDeviceManager.I"
62 
63 #endif
This class keeps track of all the devices on a system, and sends out events when a device has been ho...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
Manages a list of InputDevice objects, as returned by various InputDeviceManager methods.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
This is a structure representing a single input device.
Definition: inputDevice.h:51
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
This is a standard, non-reentrant mutex, similar to the Mutex class.
Definition: lightMutex.h:39