Trait game_engine_core::State[][src]

pub trait State<S> {
    pub fn on_start(&mut self, _state_data: &mut S) { ... }
pub fn on_stop(&mut self, _state_data: &mut S) { ... }
pub fn on_pause(&mut self, _state_data: &mut S) { ... }
pub fn on_resume(&mut self, _state_data: &mut S) { ... }
pub fn update(&mut self, _state_data: &mut S) -> StateTransition<S> { ... } }

Trait that states must implement.

Generics

  • S: State data, the data that is sent to states for them to do their operations.

Provided methods

pub fn on_start(&mut self, _state_data: &mut S)[src]

Called when the state is first inserted on the stack.

pub fn on_stop(&mut self, _state_data: &mut S)[src]

Called when the state is popped from the stack.

pub fn on_pause(&mut self, _state_data: &mut S)[src]

Called when a state is pushed over this one in the stack.

pub fn on_resume(&mut self, _state_data: &mut S)[src]

Called when the state just on top of this one in the stack is popped.

pub fn update(&mut self, _state_data: &mut S) -> StateTransition<S>[src]

Executed on every frame immediately, as fast as the engine will allow. If you need to execute logic at a predictable interval (for example, a physics engine) it is suggested to use the state data information to determine when to run such fixed timed logic.

Loading content...

Implementors

Loading content...