pub trait App {
type RenderContext;
// Required methods
fn update(&mut self, ctx: &mut Context) -> Result<()>;
fn render(&mut self, ctx: &mut Self::RenderContext) -> Result<()>;
// Provided method
fn handle(&mut self, _event: &Event<()>) -> Result<()> { ... }
}
Expand description
Application trait.
Required Associated Types§
sourcetype RenderContext
type RenderContext
Will be provided in render()
.
Required Methods§
sourcefn update(&mut self, ctx: &mut Context) -> Result<()>
fn update(&mut self, ctx: &mut Context) -> Result<()>
Application update.
Rate of updates can be set using Context
.
sourcefn render(&mut self, ctx: &mut Self::RenderContext) -> Result<()>
fn render(&mut self, ctx: &mut Self::RenderContext) -> Result<()>
Application render. Will be called once every frame.