EngineApp

Trait EngineApp 

Source
pub trait EngineApp {
    // Required methods
    fn create(engine: RenderEngine) -> Self;
    fn start(&mut self);
    fn input(&mut self, input: EngineInput);
    fn update(&mut self);
    fn resize(&mut self, new_size: PhysicalSize<u32>);
    fn exit(&mut self);
}
Expand description

A trait implemented by any struct using a render engine. The run_app function will automatically call all functions when appropriate.

Required Methods§

Source

fn create(engine: RenderEngine) -> Self

The create function is used by the run_app function to create a new app. This is to be used to initialize the app with a render engine.

Source

fn start(&mut self)

The start function is called directly after create. This is useful for running code after the engine and app are completely initialized.

Source

fn input(&mut self, input: EngineInput)

The input function is called when an input is picked up by the event loop in the run_app function. See RenderEngineInput documentation for more info.

Source

fn update(&mut self)

The update function that will be called once per frame before rendering occurs.

Source

fn resize(&mut self, new_size: PhysicalSize<u32>)

Called when the window resizes, if you are keeping a render engine around, call the engines resize function now.

Source

fn exit(&mut self)

The exit function that is called when the program exits.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§