derive macro for actions

This commit is contained in:
awtterpip
2024-03-28 20:00:54 -05:00
parent 42dc01dc6a
commit a299702f7a
5 changed files with 134 additions and 15 deletions

View File

@@ -7,25 +7,13 @@ use bevy_openxr::{
actions::{create_action_sets, ActionApp},
add_xr_plugins, resources::{TypedAction, XrActions, XrInstance},
};
use bevy_xr::actions::{Action, ActionInfo, ActionState, ActionType};
use bevy_xr::actions::{Action, ActionState};
use openxr::Binding;
#[derive(Action)]
#[action(action_type = bool, name = "jump")]
pub struct Jump;
impl Action for Jump {
type ActionType = bool;
fn info() -> ActionInfo {
ActionInfo {
pretty_name: "jump",
name: "jump",
action_type: ActionType::Bool,
type_id: TypeId::of::<Self>(),
}
}
}
fn main() {
App::new()
.add_plugins(add_xr_plugins(DefaultPlugins))