Trait gg::scene::Scene
[−]
[src]
pub trait Scene: HasId { type State: Sized + Clone; fn enter(&mut self, _state: &mut Self::State) { ... } fn leave(&mut self, _state: &mut Self::State) { ... } fn keypress(&mut self, _state: &mut Self::State, _keys: &Keys) { ... } fn display(&mut self, _state: &mut Self::State, _display: &GlutinFacade) { ... } fn tick(&mut self, _state: &mut Self::State, _dt: f64) -> SceneTransition<Self::State> { ... } }
One of the most important traits for a game, the scene is what tells the display what to draw as well as what should happen with the given input.
Associated Types
Provided Methods
fn enter(&mut self, _state: &mut Self::State)
Called everytime this scene becomes the top of the stack
fn leave(&mut self, _state: &mut Self::State)
Called everytime this scene stops being the top of the stack (also before a drop)
fn keypress(&mut self, _state: &mut Self::State, _keys: &Keys)
Convenience method where you can handle keyboard input specifically.
This is called before tick
.
fn display(&mut self, _state: &mut Self::State, _display: &GlutinFacade)
Called with a display to draw into something
fn tick(&mut self, _state: &mut Self::State, _dt: f64) -> SceneTransition<Self::State>
Called to update the state so as to reflect one advancement in time.