Path: blob/master/modules/openxr/action_map/openxr_action.h
10278 views
/**************************************************************************/1/* openxr_action.h */2/**************************************************************************/3/* This file is part of: */4/* GODOT ENGINE */5/* https://godotengine.org */6/**************************************************************************/7/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */8/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */9/* */10/* Permission is hereby granted, free of charge, to any person obtaining */11/* a copy of this software and associated documentation files (the */12/* "Software"), to deal in the Software without restriction, including */13/* without limitation the rights to use, copy, modify, merge, publish, */14/* distribute, sublicense, and/or sell copies of the Software, and to */15/* permit persons to whom the Software is furnished to do so, subject to */16/* the following conditions: */17/* */18/* The above copyright notice and this permission notice shall be */19/* included in all copies or substantial portions of the Software. */20/* */21/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */22/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */23/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */24/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */25/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */26/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */27/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */28/**************************************************************************/2930#pragma once3132#include "core/io/resource.h"3334class OpenXRActionSet;3536class OpenXRAction : public Resource {37GDCLASS(OpenXRAction, Resource);3839public:40enum ActionType {41OPENXR_ACTION_BOOL,42OPENXR_ACTION_FLOAT,43OPENXR_ACTION_VECTOR2,44OPENXR_ACTION_POSE,45OPENXR_ACTION_HAPTIC,46OPENXR_ACTION_MAX47};4849private:50String localized_name;51ActionType action_type = OPENXR_ACTION_FLOAT;5253PackedStringArray toplevel_paths;5455protected:56friend class OpenXRActionSet;5758OpenXRActionSet *action_set = nullptr; // action belongs to this action set.5960static void _bind_methods();6162public:63static 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 action64OpenXRActionSet *get_action_set() const { return action_set; } // Get the action set this action belongs to6566String get_name_with_set() const; // Retrieve the name of this action as <action_set>/<action>6768void set_localized_name(const String p_localized_name); // Set the localized name of this action69String get_localized_name() const; // Get the localized name of this action7071void set_action_type(const ActionType p_action_type); // Set the type of this action72ActionType get_action_type() const; // Get the type of this action7374void set_toplevel_paths(const PackedStringArray p_toplevel_paths); // Set the toplevel paths of this action75PackedStringArray get_toplevel_paths() const; // Get the toplevel paths of this action7677void add_toplevel_path(const String p_toplevel_path); // Add a top level path to this action78void rem_toplevel_path(const String p_toplevel_path); // Remove a toplevel path from this action7980void parse_toplevel_paths(const String p_toplevel_paths); // Parse and set the top level paths from a comma separated string81};8283VARIANT_ENUM_CAST(OpenXRAction::ActionType);848586