Debian Codegraph @

modules/openxr/action_map/openxr_action.h

raw symbols SCIP
1 /**************************************************************************/
2 /* openxr_action.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 "core/io/resource.h"
34
35 class OpenXRActionSet;
36
37 class OpenXRAction : public Resource {
38 GDCLASS(OpenXRAction, Resource);
39
40 public:
41 enum ActionType {
42 OPENXR_ACTION_BOOL,
43 OPENXR_ACTION_FLOAT,
44 OPENXR_ACTION_VECTOR2,
45 OPENXR_ACTION_POSE,
46 OPENXR_ACTION_HAPTIC,
47 OPENXR_ACTION_MAX
48 };
49
50 private:
51 String localized_name;
52 ActionType action_type = OPENXR_ACTION_FLOAT;
53
54 PackedStringArray toplevel_paths;
55
56 protected:
57 friend class OpenXRActionSet;
58
59 OpenXRActionSet *action_set = nullptr; // action belongs to this action set.
60
61 static void _bind_methods();
62
63 public:
64 static Ref<OpenXRAction> new_action(const char *p_name, const char *p_localized_name, const ActionType p_action_type, const char *p_toplevel_paths); // Helper function to add and configure an action
65 OpenXRActionSet *get_action_set() const { return action_set; } // Get the action set this action belongs to
66
67 String get_name_with_set() const; // Retrieve the name of this action as <action_set>/<action>
68
69 void set_localized_name(const String &p_localized_name); // Set the localized name of this action
70 String get_localized_name() const; // Get the localized name of this action
71
72 void set_action_type(const ActionType p_action_type); // Set the type of this action
73 ActionType get_action_type() const; // Get the type of this action
74
75 void set_toplevel_paths(const PackedStringArray p_toplevel_paths); // Set the toplevel paths of this action
76 PackedStringArray get_toplevel_paths() const; // Get the toplevel paths of this action
77
78 void add_toplevel_path(const String &p_toplevel_path); // Add a top level path to this action
79 void rem_toplevel_path(const String &p_toplevel_path); // Remove a toplevel path from this action
80
81 void parse_toplevel_paths(const String &p_toplevel_paths); // Parse and set the top level paths from a comma separated string
82 };
83
84 VARIANT_ENUM_CAST(OpenXRAction::ActionType);