pub trait Scene: Lifecycle {
// Required methods
fn on_enter(&mut self);
fn on_exit(&mut self);
fn on_render(&self, draw_list: &mut DrawList);
fn name(&self) -> &str;
}Expand description
The base trait for all game scenes.
A scene encapsulates a self-contained portion of the game world, managing its own game objects, resources, and update logic.
Required Methods§
Sourcefn on_render(&self, draw_list: &mut DrawList)
fn on_render(&self, draw_list: &mut DrawList)
Called every render frame to record the scene’s draw commands.
Instead of drawing immediately, the scene pushes DrawCommands into the
provided DrawList; the engine replays the whole list once per frame in
a single batched pass.
§Arguments
&mut DrawList- The draw list to record commands into.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".