App

Trait App 

Source
pub trait App {
    // Required methods
    fn render(
        &mut self,
        painter: &mut Painter,
        builder: &mut Builder<'_>,
        info: &Info<'_>,
    );
    fn event(&mut self, event: &WindowEvent<'_>) -> EventResult;
    fn update(&mut self, builder: &mut Builder<'_>, info: &Info<'_>);

    // Provided methods
    fn init(&mut self, _builder: &mut Builder<'_>) { ... }
    fn run(self, settings: RunSettings)
       where Self: Sized + 'static { ... }
    fn run_with_event_loop(
        self,
        event_loop: EventLoop<()>,
        settings: RunSettings,
    )
       where Self: Sized + 'static { ... }
}
Expand description

Main Application trait
handles rendering, inputs and updates

Required Methods§

Source

fn render( &mut self, painter: &mut Painter, builder: &mut Builder<'_>, info: &Info<'_>, )

Handle Rendering

Source

fn event(&mut self, event: &WindowEvent<'_>) -> EventResult

Handle Events
return true if the event was handled

Source

fn update(&mut self, builder: &mut Builder<'_>, info: &Info<'_>)

Handle Update (called before render)

Provided Methods§

Source

fn init(&mut self, _builder: &mut Builder<'_>)

Handle Initialization

Source

fn run(self, settings: RunSettings)
where Self: Sized + 'static,

Runs the App

continuous: draw continuously or after an event title: the title of the window

Source

fn run_with_event_loop(self, event_loop: EventLoop<()>, settings: RunSettings)
where Self: Sized + 'static,

Runs the App

Implementors§