pub struct SceneManager { /* private fields */ }Expand description
Manages scene registration, transitions, and lifecycle.
Implementations§
Source§impl SceneManager
Implements static scene creation for SceneManager.
impl SceneManager
Implements static scene creation for SceneManager.
Source§impl SceneManager
Implements scene registration and lifecycle management for SceneManager.
impl SceneManager
Implements scene registration and lifecycle management for SceneManager.
Sourcepub fn register(&mut self, name: String, scene: SceneRc)
pub fn register(&mut self, name: String, scene: SceneRc)
Registers a scene under the given name.
§Arguments
String- The name to register the scene under.SceneRc- The scene to register.
Sourcepub fn unregister<N>(&mut self, name: N)
pub fn unregister<N>(&mut self, name: N)
Unregisters and removes the scene with the given name.
§Arguments
N: AsRef<str>- The name of the scene to remove.
Sourcepub fn request_transition(&mut self, name: String)
pub fn request_transition(&mut self, name: String)
Requests a deferred scene transition to be applied on the next update.
§Arguments
String- The name of the scene to switch to.
Sourcepub fn process_pending_transition(&mut self)
pub fn process_pending_transition(&mut self)
Processes a pending scene transition if one was requested.
Sourcepub fn render(&mut self, context: &CanvasRenderingContext2d)
pub fn render(&mut self, context: &CanvasRenderingContext2d)
Calls on_render on the current scene, recording into the shared draw list.
The manager’s reusable DrawList is cleared, filled by the scene, and
left populated for the caller to replay (e.g. via
CanvasRenderer::replay). Reusing the list avoids per-frame allocation.
§Arguments
&CanvasRenderingContext2d- The canvas rendering context used to replay the recorded commands.
Sourcepub fn current_name(&self) -> Option<&str>
pub fn current_name(&self) -> Option<&str>
Returns the name of the currently active scene.
§Returns
Option<&str>- The current scene name, orNone.
Source§impl SceneManager
impl SceneManager
Trait Implementations§
Source§impl Clone for SceneManager
impl Clone for SceneManager
Source§fn clone(&self) -> SceneManager
fn clone(&self) -> SceneManager
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Default for SceneManager
Implements Default for SceneManager as a new empty manager.
impl Default for SceneManager
Implements Default for SceneManager as a new empty manager.
Source§fn default() -> SceneManager
fn default() -> SceneManager
Source§impl Updatable for SceneManager
Forwards SceneManager::update through the Updatable trait so that
scene managers can be driven alongside entities, animators, and physics
worlds in a single homogeneous update loop.
impl Updatable for SceneManager
Forwards SceneManager::update through the Updatable trait so that
scene managers can be driven alongside entities, animators, and physics
worlds in a single homogeneous update loop.
The inherent SceneManager::update method is the canonical implementation;
this impl exists purely for trait dispatch. The inherent call resolves
first when both are in scope, so there is no recursion.