-
Notifications
You must be signed in to change notification settings - Fork 60
/
ControllerDevice.hpp
81 lines (60 loc) · 3 KB
/
ControllerDevice.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
#pragma once
#include <chrono>
#include <cmath>
#include <linalg.h>
#include <Driver/IVRDevice.hpp>
#include <Native/DriverFactory.hpp>
namespace ExampleDriver {
class ControllerDevice : public IVRDevice {
public:
enum class Handedness {
LEFT,
RIGHT,
ANY
};
ControllerDevice(std::string serial, Handedness handedness = Handedness::ANY);
~ControllerDevice() = default;
// Inherited via IVRDevice
virtual std::string GetSerial() override;
virtual void Update() override;
virtual vr::TrackedDeviceIndex_t GetDeviceIndex() override;
virtual DeviceType GetDeviceType() override;
virtual Handedness GetHandedness();
virtual vr::EVRInitError Activate(uint32_t unObjectId) override;
virtual void Deactivate() override;
virtual void EnterStandby() override;
virtual void* GetComponent(const char* pchComponentNameAndVersion) override;
virtual void DebugRequest(const char* pchRequest, char* pchResponseBuffer, uint32_t unResponseBufferSize) override;
virtual vr::DriverPose_t GetPose() override;
private:
vr::TrackedDeviceIndex_t device_index_ = vr::k_unTrackedDeviceIndexInvalid;
std::string serial_;
Handedness handedness_;
vr::DriverPose_t last_pose_;
bool did_vibrate_ = false;
float vibrate_anim_state_ = 0.f;
vr::VRInputComponentHandle_t haptic_component_ = 0;
vr::VRInputComponentHandle_t a_button_click_component_ = 0;
vr::VRInputComponentHandle_t a_button_touch_component_ = 0;
vr::VRInputComponentHandle_t b_button_click_component_ = 0;
vr::VRInputComponentHandle_t b_button_touch_component_ = 0;
vr::VRInputComponentHandle_t trigger_value_component_ = 0;
vr::VRInputComponentHandle_t trigger_click_component_ = 0;
vr::VRInputComponentHandle_t trigger_touch_component_ = 0;
vr::VRInputComponentHandle_t grip_touch_component_ = 0;
vr::VRInputComponentHandle_t grip_value_component_ = 0;
vr::VRInputComponentHandle_t grip_force_component_ = 0;
vr::VRInputComponentHandle_t system_click_component_ = 0;
vr::VRInputComponentHandle_t system_touch_component_ = 0;
vr::VRInputComponentHandle_t trackpad_click_component_ = 0;
vr::VRInputComponentHandle_t trackpad_touch_component_ = 0;
vr::VRInputComponentHandle_t trackpad_x_component_ = 0;
vr::VRInputComponentHandle_t trackpad_y_component_ = 0;
vr::VRInputComponentHandle_t joystick_click_component_ = 0;
vr::VRInputComponentHandle_t joystick_touch_component_ = 0;
vr::VRInputComponentHandle_t joystick_x_component_ = 0;
vr::VRInputComponentHandle_t joystick_y_component_ = 0;
//vr::VRInputComponentHandle_t skeleton_left_component_ = 0;
//vr::VRInputComponentHandle_t skeleton_right_component_ = 0;
};
};