pub trait EngineComponent<T> {
// Required methods
fn create(engine: &mut RenderEngine) -> Self;
fn start(&mut self, other: T);
fn update(&mut self, other: T);
fn render<'rpass>(
&'rpass mut self,
render_engine: &'rpass RenderEngine,
pass: &mut RenderPass<'rpass>,
);
fn exit(&mut self, other: T);
}Expand description
A trait defining the standard functions for a component to be used by the engine.
T - The other components needed from the engine to use this component.
Required Methods§
Sourcefn create(engine: &mut RenderEngine) -> Self
fn create(engine: &mut RenderEngine) -> Self
Creates a new instance of this component using a mutable reference to a RenderEngine.
Sourcefn start(&mut self, other: T)
fn start(&mut self, other: T)
Called when the engine starts all the components after they are all created.
Sourcefn render<'rpass>(
&'rpass mut self,
render_engine: &'rpass RenderEngine,
pass: &mut RenderPass<'rpass>,
)
fn render<'rpass>( &'rpass mut self, render_engine: &'rpass RenderEngine, pass: &mut RenderPass<'rpass>, )
Called when this component is called to render during its render pass defined in the created App.
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.