feat: add XrSessionDestroyedEvent to allow crate consumers to react to the destruction to, for example, start another session

Signed-off-by: Schmarni <marnistromer@gmail.com>
This commit is contained in:
Schmarni
2025-02-10 03:24:39 +01:00
parent 23da8847f1
commit 010c1d8e16
3 changed files with 35 additions and 9 deletions

View File

@@ -46,10 +46,14 @@ pub struct XrPostSessionBegin;
#[derive(Event, Clone, Copy, Default)]
pub struct XrEndSessionEvent;
/// Schedule thats rna whenever the XrSession is about to end
/// Schedule thats ran whenever the XrSession is about to end
#[derive(Clone, Copy, Default, PartialEq, Eq, Debug, Hash, ScheduleLabel)]
pub struct XrPreSessionEnd;
/// Event that is emitted when the XrSession is fully destroyed
#[derive(Clone, Copy, Default, PartialEq, Eq, Debug, Hash, Event)]
pub struct XrSessionDestroyedEvent;
/// Event sent to backends to request the [`XrState`] proceed to [`Exiting`](XrState::Exiting) and for the session to be exited. Can be called at any time a session exists.
#[derive(Event, Clone, Copy, Default)]
pub struct XrRequestExitEvent;
@@ -130,6 +134,7 @@ impl Plugin for XrSessionPlugin {
.add_event::<XrRequestExitEvent>()
.add_event::<XrStateChanged>()
.add_event::<XrSessionCreatedEvent>()
.add_event::<XrSessionDestroyedEvent>()
.init_schedule(XrSessionCreated)
.init_schedule(XrPreDestroySession)
.init_schedule(XrPostSessionBegin)