pub trait Component<R, E>where
    R: Sized + Debug,
    E: Sized + Debug,
{ fn on_attach(&mut self, render_context: &mut RenderContext) -> Result<R, E>; fn on_detach(&mut self, render_context: &mut RenderContext) -> Result<R, E>; fn on_event(&mut self, event: Events) -> Result<R, E>; fn on_update(&mut self, last_frame: &Duration) -> Result<R, E>; fn on_render(
        &mut self,
        render_context: &mut RenderContext
    ) -> Vec<RenderCommand>; }
Expand description

The Component Interface for allowing Component based data structures like the ComponentStack to store components with various purposes and implementations to work together.

Required Methods§

The attach function is called when the component is added to the component data storage a runtime is using.

The detach function is called when the component is removed from the component data storage a runtime is using.

The event function is called every time an event is received from the windowing system/event loop.

The update function is called every frame and is used to update the state of the component.

Render commands returned from this function will be executed by the renderer immediately.

Implementors§