change scheduling

Signed-off-by: Schmarni <marnistromer@gmail.com>
This commit is contained in:
Schmarni
2024-05-19 04:48:49 +02:00
parent 72f2e7174e
commit fb9ec378c8
12 changed files with 292 additions and 127 deletions

View File

@@ -5,19 +5,23 @@ use bevy::ecs::schedule::ScheduleLabel;
use bevy::ecs::system::RunSystemOnce;
use bevy::prelude::*;
use bevy::utils::HashMap;
use bevy_xr::session::{status_changed_to, XrStatus};
use openxr::sys::ActionSuggestedBinding;
use crate::resources::OxrInstance;
use crate::{init::OxrPreUpdateSet, resources::OxrInstance, session::OxrSessionStatusEvent};
impl Plugin for OxrActionBindingPlugin {
fn build(&self, app: &mut App) {
app.add_schedule(Schedule::new(OxrSendActionBindings));
app.add_event::<OxrSuggestActionBinding>();
app.add_systems(
Update,
PostUpdate,
run_action_binding_sugestion
.run_if(status_changed_to(XrStatus::Ready).and_then(run_once())),
.run_if(|mut session_state: EventReader<OxrSessionStatusEvent>| {
session_state
.read()
.any(|s| *s == OxrSessionStatusEvent::Created)
})
.after(OxrPreUpdateSet::HandleEvents),
);
}
}