Trait agents::app::State [−][src]
pub trait State { fn init(
&mut self,
window: &mut Window,
graphics: &mut Graphics
) -> Result<()> { ... } fn update(
&mut self,
window: &mut Window,
graphics: &mut Graphics,
update_duration: Duration
) -> Result<()> { ... } fn handle_event(
&mut self,
window_event: &WindowEvent,
window: &mut Window,
graphics: &mut Graphics
) -> Result<()> { ... } }
Expand description
Each application maintains an instance of State which controls the actual behavior and rendering.
Provided methods
Invoked by the application once just before the first update/render.
This can be useful if any initialization needs to be done before rendering but after constructing the instance for some reason. Or if the application has need to setup some visuals which never change.
Called once each frame before presenting the framebuffer.
fn handle_event(
&mut self,
window_event: &WindowEvent,
window: &mut Window,
graphics: &mut Graphics
) -> Result<()>
fn handle_event(
&mut self,
window_event: &WindowEvent,
window: &mut Window,
graphics: &mut Graphics
) -> Result<()>
Handle a glfw window event.
The application can be stopped by calling window.set_should_close
.
By default, the application will close when esc
is pressed.