[−][src]Trait tetra::State
A trait representing a type that contains game state and provides logic for updating it and drawing it to the screen. This is where you'll write your game logic!
The methods on State
allow you to return a Result
, either explicitly or via the ?
operator. If an error is returned, the game will close and the error will be returned from
the run
function that was used to start it.
Provided methods
fn update(&mut self, ctx: &mut Context) -> Result
Called when it is time for the game to update.
fn draw(&mut self, ctx: &mut Context) -> Result
Called when it is time for the game to be drawn.
fn event(&mut self, ctx: &mut Context, event: Event) -> Result
Called when a window or input event occurs.