pub struct SceneManager { /* private fields */ }Expand description
Manages a stack of scenes with transitions.
§Example
let mut scenes = SceneManager::new();
scenes.push(MenuScene::new());
// In game loop:
scenes.update(ctx);
scenes.render(ctx);
// From within a scene:
// scenes.push(GameScene::new(level));
// scenes.pop(); // return to previous scene
// scenes.replace(SettingsScene::new()); // replace current sceneImplementations§
Source§impl SceneManager
impl SceneManager
Sourcepub fn push_with_transition<S: Scene>(
&mut self,
scene: S,
transition: Transition,
)
pub fn push_with_transition<S: Scene>( &mut self, scene: S, transition: Transition, )
Push a scene with a transition effect.
Sourcepub fn pop_with_transition(&mut self, transition: Transition)
pub fn pop_with_transition(&mut self, transition: Transition)
Pop with a transition effect.
Sourcepub fn current(&self) -> Option<&dyn Scene>
pub fn current(&self) -> Option<&dyn Scene>
Get a reference to the current (top) scene, if any.
Sourcepub fn current_mut(&mut self) -> Option<&mut dyn Scene>
pub fn current_mut(&mut self) -> Option<&mut dyn Scene>
Get a mutable reference to the current scene, if any.
Auto Trait Implementations§
impl !RefUnwindSafe for SceneManager
impl !Send for SceneManager
impl !Sync for SceneManager
impl !UnwindSafe for SceneManager
impl Freeze for SceneManager
impl Unpin for SceneManager
impl UnsafeUnpin for SceneManager
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more