Debian Codegraph @

modules/openxr/extensions/openxr_dpad_binding_extension.h

raw symbols SCIP
1 /**************************************************************************/
2 /* openxr_dpad_binding_extension.h */
3 /**************************************************************************/
4 /* This file is part of: */
5 /* GODOT ENGINE */
6 /* https://godotengine.org */
7 /**************************************************************************/
8 /* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
9 /* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
10 /* */
11 /* Permission is hereby granted, free of charge, to any person obtaining */
12 /* a copy of this software and associated documentation files (the */
13 /* "Software"), to deal in the Software without restriction, including */
14 /* without limitation the rights to use, copy, modify, merge, publish, */
15 /* distribute, sublicense, and/or sell copies of the Software, and to */
16 /* permit persons to whom the Software is furnished to do so, subject to */
17 /* the following conditions: */
18 /* */
19 /* The above copyright notice and this permission notice shall be */
20 /* included in all copies or substantial portions of the Software. */
21 /* */
22 /* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
23 /* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
24 /* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
25 /* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
26 /* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
27 /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
28 /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
29 /**************************************************************************/
30
31 #pragma once
32
33 #include "../action_map/openxr_action_set.h"
34 #include "../action_map/openxr_binding_modifier.h"
35 #include "../action_map/openxr_haptic_feedback.h"
36 #include "../util.h"
37 #include "openxr_extension_wrapper.h"
38
39 class OpenXRDPadBindingExtension : public OpenXRExtensionWrapper {
40 GDCLASS(OpenXRDPadBindingExtension, OpenXRExtensionWrapper);
41
42 protected:
43 static void _bind_methods() {}
44
45 public:
46 static OpenXRDPadBindingExtension *get_singleton();
47
48 OpenXRDPadBindingExtension();
49 virtual ~OpenXRDPadBindingExtension() override;
50
51 virtual HashMap<String, bool *> get_requested_extensions(XrVersion p_version) override;
52
53 bool is_available();
54
55 private:
56 static OpenXRDPadBindingExtension *singleton;
57
58 bool binding_modifier_ext = false;
59 bool dpad_binding_ext = false;
60 };
61
62 class OpenXRDpadBindingModifier : public OpenXRIPBindingModifier {
63 GDCLASS(OpenXRDpadBindingModifier, OpenXRIPBindingModifier);
64
65 private:
66 PackedByteArray dpad_bindings_data;
67 XrInteractionProfileDpadBindingEXT *dpad_bindings = nullptr;
68 String input_path;
69 Ref<OpenXRActionSet> action_set;
70 Ref<OpenXRHapticBase> on_haptic;
71 Ref<OpenXRHapticBase> off_haptic;
72
73 protected:
74 static void _bind_methods();
75
76 public:
77 OpenXRDpadBindingModifier();
78
79 void set_action_set(const Ref<OpenXRActionSet> &p_action_set);
80 Ref<OpenXRActionSet> get_action_set() const;
81
82 void set_input_path(const String &p_input_path);
83 String get_input_path() const;
84
85 void set_threshold(float p_threshold);
86 float get_threshold() const;
87
88 void set_threshold_released(float p_threshold);
89 float get_threshold_released() const;
90
91 void set_center_region(float p_center_region);
92 float get_center_region() const;
93
94 void set_wedge_angle(float p_wedge_angle);
95 float get_wedge_angle() const;
96
97 void set_wedge_angle_deg(float p_wedge_angle);
98 float get_wedge_angle_deg() const;
99
100 void set_is_sticky(bool p_sticky);
101 bool get_is_sticky() const;
102
103 void set_on_haptic(const Ref<OpenXRHapticBase> &p_haptic);
104 Ref<OpenXRHapticBase> get_on_haptic() const;
105
106 void set_off_haptic(const Ref<OpenXRHapticBase> &p_haptic);
107 Ref<OpenXRHapticBase> get_off_haptic() const;
108
109 virtual String get_description() const override { return "DPad modifier"; }
110 virtual PackedByteArray get_ip_modification() override;
111 };