Etterna 0.74.4
Loading...
Searching...
No Matches
JoystickDevice.h
1#ifndef JOYSTICK_DEVICE_H
2#define JOYSTICK_DEVICE_H
3
4#include "HIDDevice.h"
5
6struct Joystick
7{
8 InputDevice id;
9 // map cookie to button
10 __gnu_cxx::hash_map<IOHIDElementCookie, DeviceButton> mapping;
11 IOHIDElementCookie x_axis, y_axis, z_axis, x_rot, y_rot, z_rot, hat;
12 int x_min, x_max;
13 int y_min, y_max;
14 int z_min, z_max;
15 int rx_min, rx_max;
16 int ry_min, ry_max;
17 int rz_min, rz_max;
18 int hat_min, hat_max;
19
20 Joystick();
21};
22
24{
25 private:
26 std::vector<Joystick> m_vSticks;
27
28 protected:
29 bool AddLogicalDevice(int usagePage, int usage);
30 void AddElement(int usagePage,
31 int usage,
32 IOHIDElementCookie cookie,
33 const CFDictionaryRef properties);
34 void Open();
35 bool InitDevice(int vid, int pid);
36
37 public:
38 void GetButtonPresses(
39 std::vector<DeviceInput>& vPresses,
40 IOHIDElementCookie cookie,
41 int value,
42 const std::chrono::time_point<std::chrono::steady_clock>& now) const;
43 int AssignIDs(InputDevice startID);
44 void GetDevicesAndDescriptions(std::vector<InputDeviceInfo>& vDevices) const;
45};
46
47#endif
Definition HIDDevice.h:70
Definition JoystickDevice.h:24
Definition JoystickDevice.h:7