pub trait Middleware<Init, UpdateContext, Surface, Event, EventContext, Control> {
// Required methods
fn on_init(&mut self, init: &mut Init);
fn on_update(&mut self, context: &mut UpdateContext);
fn on_render(&mut self, surface: &mut Surface);
fn on_event(
&mut self,
event: Event,
event_context: &EventContext,
event_control: &mut Control,
) -> Option<Event>;
}
Expand description
Middleware is an adapter between a backend and an application itself.
Required Methods§
Sourcefn on_update(&mut self, context: &mut UpdateContext)
fn on_update(&mut self, context: &mut UpdateContext)
Handle the update tick.
Sourcefn on_render(&mut self, surface: &mut Surface)
fn on_render(&mut self, surface: &mut Surface)
Handle render call, draw on the provided surface.
Sourcefn on_event(
&mut self,
event: Event,
event_context: &EventContext,
event_control: &mut Control,
) -> Option<Event>
fn on_event( &mut self, event: Event, event_context: &EventContext, event_control: &mut Control, ) -> Option<Event>
Handle event originated from the backend.