Panda3D

xInputDevice.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 xInputDevice.h
10 * @author rdb
11 * @date 2015-07-15
12 */
13
14 #ifndef XINPUTDEVICE_H
15 #define XINPUTDEVICE_H
16
17 #include "pandabase.h"
18 #include "inputDevice.h"
19
20 #if defined(_WIN32) && !defined(CPPPARSER)
21
22 #include <cfgmgr32.h>
23
24 class InputDeviceManager;
25
26 typedef struct _XINPUT_CAPABILITIES_EX XINPUT_CAPABILITIES_EX;
27 typedef struct _XINPUT_STATE XINPUT_STATE;
28
29 typedef struct tagRID_DEVICE_INFO RID_DEVICE_INFO;
30
31 /**
32 * This implementation of InputDevice uses Microsoft's XInput library to
33 * interface with an Xbox 360 game controller.
34 *
35 * @since 1.10.0
36 */
37 class EXPCL_PANDA_DEVICE XInputDevice final : public InputDevice {
38 public:
39 XInputDevice(DWORD user_index);
40 ~XInputDevice();
41
42 bool check_arrival(const RID_DEVICE_INFO &info, DEVINST inst,
43 const std::string &name, const std::string &manufacturer);
44 void detect(InputDeviceManager *mgr);
45 static bool init_xinput();
46
47 private:
48 void init_device(const XINPUT_CAPABILITIES_EX &caps, const XINPUT_STATE &state);
49 virtual void do_set_vibration(double strong, double weak);
50 virtual void do_poll();
51
52 private:
53 const DWORD _index;
54 DWORD _last_packet;
55 WORD _last_buttons;
56
57 static bool _initialized;
58 };
59
60 #endif // _WIN32
61
62 #endif
InputDeviceManager
This class keeps track of all the devices on a system, and sends out events when a device has been ho...
Definition: inputDeviceManager.h:33
InputDevice
This is a structure representing a single input device.
Definition: inputDevice.h:53
inputDevice.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
pandabase.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.