openxr_action_set.h 3.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  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. #ifndef OPENXR_ACTION_SET_H
  31. #define OPENXR_ACTION_SET_H
  32. #include "openxr_action.h"
  33. #include "core/io/resource.h"
  34. class OpenXRActionSet : public Resource {
  35. GDCLASS(OpenXRActionSet, Resource);
  36. private:
  37. String localized_name;
  38. int priority = 0;
  39. Array actions;
  40. void clear_actions();
  41. protected:
  42. static void _bind_methods();
  43. public:
  44. 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
  45. void set_localized_name(const String p_localized_name); // Set the localized name of this action set
  46. String get_localized_name() const; // Get the localized name of this action set
  47. void set_priority(const int p_priority); // Set the priority of this action set
  48. int get_priority() const; // Get the priority of this action set
  49. int get_action_count() const; // Retrieve the number of actions in our action set
  50. void set_actions(Array p_actions); // Set our actions using an array of actions (for loading a resource)
  51. Array get_actions() const; // Get our actions as an array (for saving a resource)
  52. Ref<OpenXRAction> get_action(const String p_name) const; // Retrieve an action by name
  53. void add_action(Ref<OpenXRAction> p_action); // Add a new action to our action set
  54. void remove_action(Ref<OpenXRAction> p_action); // remove a action from our action set
  55. 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
  56. // TODO add validation to display in the interface that checks if we have duplicate action names within our action set
  57. ~OpenXRActionSet();
  58. };
  59. #endif // OPENXR_ACTION_SET_H