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§
Sourcefn create(engine: RenderEngine) -> Self
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.
Sourcefn start(&mut self)
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.
Sourcefn input(&mut self, input: EngineInput)
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.
Sourcefn update(&mut self)
fn update(&mut self)
The update function that will be called once per frame before rendering occurs.
Sourcefn resize(&mut self, new_size: PhysicalSize<u32>)
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.
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.