Panda3D

Loading...
Searching...
No Matches
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 * @since 1.10.0
32 */
33 class EXPCL_PANDA_DEVICE InputDeviceManager {
34 protected:
35 InputDeviceManager();
36 ~InputDeviceManager() = default;
37
38 static void make_global_ptr();
39
40PUBLISHED:
41 InputDeviceSet get_devices() const;
42 InputDeviceSet get_devices(InputDevice::DeviceClass device_class) const;
43
44 void add_device(InputDevice *device);
45 void remove_device(InputDevice *device);
46
47 virtual void update();
48
49 INLINE static InputDeviceManager *get_global_ptr();
50
51 protected:
52 LightMutex _lock;
53
54#ifdef PHAVE_LINUX_INPUT_H
55 InputDeviceSet _inactive_devices;
56#endif
57
58 InputDeviceSet _connected_devices;
59
60 static InputDeviceManager *_global_ptr;
61};
62
63#include "inputDeviceManager.I"
64
65#endif
InputDeviceManager::add_device
void add_device(InputDevice *device)
Called when a new device has been discovered.
Definition inputDeviceManager.cxx:92
InputDeviceManager::get_devices
InputDeviceSet get_devices() const
Description: Returns all currently connected devices.
Definition inputDeviceManager.cxx:54
InputDeviceManager::update
virtual void update()
Polls the system to see if there are any new devices.
Definition inputDeviceManager.cxx:129
InputDeviceManager::get_global_ptr
static InputDeviceManager * get_global_ptr()
Returns the singleton InputDeviceManager instance.
Definition inputDeviceManager.I:18
InputDeviceManager::remove_device
void remove_device(InputDevice *device)
Called when a device has been removed, or when a device should otherwise no longer be tracked.
Definition inputDeviceManager.cxx:113
InputDeviceSet
Manages a list of InputDevice objects, as returned by various InputDeviceManager methods.
Definition inputDeviceSet.h:26
InputDevice
This is a structure representing a single input device.
Definition inputDevice.h:53
LightMutex
This is a standard, non-reentrant mutex, similar to the Mutex class.
Definition lightMutex.h:41
inputDeviceManager.I
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
inputDeviceSet.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
inputDevice.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
lightMutex.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
pandabase.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
xInputDevice.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.