EngineComponent

Trait EngineComponent 

Source
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§

Source

fn create(engine: &mut RenderEngine) -> Self

Creates a new instance of this component using a mutable reference to a RenderEngine.

Source

fn start(&mut self, other: T)

Called when the engine starts all the components after they are all created.

Source

fn update(&mut self, other: T)

Called when the engine updates.

Source

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.

Source

fn exit(&mut self, other: T)

Called when the engine 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§