Trait ytesrev::scene::Scene

source ·
pub trait Scene: Send {
    fn update(&mut self, _dt: f64);
    fn draw(&self, canvas: &mut Canvas<Window>, settings: DrawSettings);
    fn event(&mut self, _event: YEvent);
    fn action(&self) -> Action;
    fn register(&mut self);
    fn load(&mut self);
}
Expand description

A scene is like a Drawable, but without the modularity, it’s in the top level and no wrappers for it exists. Unless you’re doing something advanced, a DrawableWrapper around your Drawables should do fine.

Required Methods

Do a tick

Draw the content of this scene to a Canvas.

Called when an event occured

What to do

Register everything. The scene equivalent of Drawable::register

Load everything. The scene equivalent of Drawable::load

Implementors