| 1 | /**************************************************************************/ | 
|---|
| 2 | /*  openxr_action_set.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 | #ifndef OPENXR_ACTION_SET_H | 
|---|
| 32 | #define OPENXR_ACTION_SET_H | 
|---|
| 33 |  | 
|---|
| 34 | #include "openxr_action.h" | 
|---|
| 35 |  | 
|---|
| 36 | #include "core/io/resource.h" | 
|---|
| 37 |  | 
|---|
| 38 | class OpenXRActionSet : public Resource { | 
|---|
| 39 | GDCLASS(OpenXRActionSet, Resource); | 
|---|
| 40 |  | 
|---|
| 41 | private: | 
|---|
| 42 | String localized_name; | 
|---|
| 43 | int priority = 0; | 
|---|
| 44 |  | 
|---|
| 45 | Array actions; | 
|---|
| 46 | void clear_actions(); | 
|---|
| 47 |  | 
|---|
| 48 | protected: | 
|---|
| 49 | static void _bind_methods(); | 
|---|
| 50 |  | 
|---|
| 51 | public: | 
|---|
| 52 | static Ref<OpenXRActionSet> new_action_set(const char *p_name, const char *p_localized_name, const int p_priority = 0); // Helper function for adding and setting up an action set | 
|---|
| 53 |  | 
|---|
| 54 | void set_localized_name(const String p_localized_name); // Set the localized name of this action set | 
|---|
| 55 | String get_localized_name() const; // Get the localized name of this action set | 
|---|
| 56 |  | 
|---|
| 57 | void set_priority(const int p_priority); // Set the priority of this action set | 
|---|
| 58 | int get_priority() const; // Get the priority of this action set | 
|---|
| 59 |  | 
|---|
| 60 | int get_action_count() const; // Retrieve the number of actions in our action set | 
|---|
| 61 | void set_actions(Array p_actions); // Set our actions using an array of actions (for loading a resource) | 
|---|
| 62 | Array get_actions() const; // Get our actions as an array (for saving a resource) | 
|---|
| 63 |  | 
|---|
| 64 | Ref<OpenXRAction> get_action(const String p_name) const; // Retrieve an action by name | 
|---|
| 65 | void add_action(Ref<OpenXRAction> p_action); // Add a new action to our action set | 
|---|
| 66 | void remove_action(Ref<OpenXRAction> p_action); // remove a action from our action set | 
|---|
| 67 |  | 
|---|
| 68 | Ref<OpenXRAction> add_new_action(const char *p_name, const char *p_localized_name, const OpenXRAction::ActionType p_action_type, const char *p_toplevel_paths); // Helper function for adding and setting up an action | 
|---|
| 69 |  | 
|---|
| 70 | // TODO add validation to display in the interface that checks if we have duplicate action names within our action set | 
|---|
| 71 |  | 
|---|
| 72 | ~OpenXRActionSet(); | 
|---|
| 73 | }; | 
|---|
| 74 |  | 
|---|
| 75 | #endif // OPENXR_ACTION_SET_H | 
|---|
| 76 |  | 
|---|