Panda3D
Loading...
Searching...
No Matches
ioKitInputDevice.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 ioKitInputDevice.h
10 * @author rdb
11 * @date 2017-12-21
12 */
13
14#ifndef IOKITINPUTDEVICE_H
15#define IOKITINPUTDEVICE_H
16
17#include "pandabase.h"
18#include "inputDevice.h"
19
20#if defined(__APPLE__) && !defined(CPPPARSER)
21
22#include <IOKit/hid/IOHIDDevice.h>
23
24/**
25 * This implementation uses the IOKit HID code that was introduced with macOS
26 * 10.5 to interface with USB HID devices.
27 */
28class EXPCL_PANDA_DEVICE IOKitInputDevice final : public InputDevice {
29public:
30 IOKitInputDevice(IOHIDDeviceRef device);
31 ~IOKitInputDevice();
32
33private:
34 void parse_element(IOHIDElementRef element);
35
36 virtual void do_poll();
37
38 IOHIDDeviceRef _device;
39 pvector<IOHIDElementRef> _button_elements;
40 pvector<IOHIDElementRef> _analog_elements;
41 IOHIDElementRef _hat_element;
42 int _hat_left_button;
43 IOHIDElementRef _pointer_x;
44 IOHIDElementRef _pointer_y;
45 IOHIDElementRef _scroll_wheel;
46 uint64_t _pointer_x_timestamp;
47 uint64_t _pointer_y_timestamp;
48 uint64_t _scroll_wheel_timestamp;
49};
50
51#endif // __APPLE__
52
53#endif
This is a structure representing a single input device.
Definition inputDevice.h:53
This is our own Panda specialization on the default STL vector.
Definition pvector.h:42
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.