Skip to main content

Plugin

Trait Plugin 

Source
pub trait Plugin {
    // Required methods
    fn name(&self) -> &'static str;
    fn build(&self, app: &mut GameApp);
}
Expand description

A plugin that configures systems, hooks, and initial world state.

Plugins provide a modular way to compose game functionality. Each plugin gets access to a GameApp builder during build().

§Example

struct PhysicsPlugin;

impl Plugin for PhysicsPlugin {
    fn name(&self) -> &'static str { "physics" }
    fn build(&self, app: &mut GameApp) {
        app.add_system("gravity", gravity_system);
        app.add_system("collision", collision_system);
    }
}

Required Methods§

Source

fn name(&self) -> &'static str

Source

fn build(&self, app: &mut GameApp)

Implementors§