Panda3D
Loading...
Searching...
No Matches
winInputDeviceManager.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 winInputDeviceManager.h
10 * @author rdb
11 * @date 2018-01-21
12 */
13
14#ifndef WININPUTDEVICEMANAGER_H
15#define WININPUTDEVICEMANAGER_H
16
17#include "inputDeviceManager.h"
18
19#if defined(_WIN32) && !defined(CPPPARSER)
20
21#include "xInputDevice.h"
22
23#include <cfgmgr32.h>
24#include <devpkey.h>
25
26class WinRawInputDevice;
27
28/**
29 * This is the Windows implementation of InputDeviceManager, managing both
30 * XInput controllers and raw input devices.
31 */
32class EXPCL_PANDA_DEVICE WinInputDeviceManager final : public InputDeviceManager {
33private:
34 WinInputDeviceManager();
35 ~WinInputDeviceManager();
36
37public:
38 void device_destroyed(WinRawInputDevice *device);
39
40 void on_input(HRAWINPUT handle);
41 void on_input_device_arrival(HANDLE handle);
42 void on_input_device_removal(HANDLE handle);
43
44 HWND setup_message_loop();
45 void destroy_message_loop();
46
47 static void stop_thread();
48
49private:
50 // There are always exactly four of these in existence.
51 XInputDevice _xinput_device0;
52 XInputDevice _xinput_device1;
53 XInputDevice _xinput_device2;
54 XInputDevice _xinput_device3;
55
56 HWND _message_hwnd;
58 pmap<std::string, WinRawInputDevice *> _raw_devices_by_path;
59
60 virtual void update() override;
61
62 static LRESULT WINAPI window_proc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam);
63
64 typedef CONFIGRET (WINAPI *pCM_Get_DevNode_Property)(DEVINST, const DEVPROPKEY *, DEVPROPTYPE *, PBYTE, PULONG, ULONG);
65 pCM_Get_DevNode_Property _CM_Get_DevNode_PropertyW;
66
67 friend class InputDeviceManager;
68};
69
70#endif
71#endif
This class keeps track of all the devices on a system, and sends out events when a device has been ho...
virtual void update()
Polls the system to see if there are any new devices.
This is our own Panda specialization on the default STL map.
Definition pmap.h:49
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.