Trait win_loop::App

source ·
pub trait App {
    type RenderContext;

    // Required methods
    fn update(&mut self, ctx: &mut Context) -> Result<()>;
    fn render(
        &mut self,
        ctx: &mut Self::RenderContext,
        blending_factor: f64
    ) -> Result<()>;

    // Provided method
    fn handle(&mut self, _event: &Event<()>) -> Result<()> { ... }
}
Expand description

Application trait.

Required Associated Types§

source

type RenderContext

Will be provided in render().

Required Methods§

source

fn update(&mut self, ctx: &mut Context) -> Result<()>

Application update. Rate of updates can be set using Context.

source

fn render( &mut self, ctx: &mut Self::RenderContext, blending_factor: f64 ) -> Result<()>

Application render. Will be called once every frame.

Provided Methods§

source

fn handle(&mut self, _event: &Event<()>) -> Result<()>

Custom event handler if needed.

Implementors§