pub trait SceneType {
type SpawnableIdType: SpawnableEnum + 'static;
fn new() -> Self
where
Self: Sized;
fn config(&mut self, game: &mut GameControl) -> SceneConfig<Self>
where
Self: Sized;
fn spawn(
&mut self,
spawn: &mut SpawnControl,
spawnable_id: Self::SpawnableIdType,
game: &mut GameControl,
x: f64,
y: f64,
args: &DynArgList
) { ... }
}
Expand description
A trait containing information on how to instantiate spawnables in the scene, and which systems this scene should include.
Required Associated Types
type SpawnableIdType: SpawnableEnum + 'static
type SpawnableIdType: SpawnableEnum + 'static
The enum to use to identify different spawnables. You can generate this using the spawnables! macro.
Required Methods
fn config(&mut self, game: &mut GameControl) -> SceneConfig<Self> where
Self: Sized,
fn config(&mut self, game: &mut GameControl) -> SceneConfig<Self> where
Self: Sized,
Used to create a SceneConfig object, which includes information such as which systems to use.
Provided Methods
fn spawn(
&mut self,
spawn: &mut SpawnControl,
spawnable_id: Self::SpawnableIdType,
game: &mut GameControl,
x: f64,
y: f64,
args: &DynArgList
)
fn spawn(
&mut self,
spawn: &mut SpawnControl,
spawnable_id: Self::SpawnableIdType,
game: &mut GameControl,
x: f64,
y: f64,
args: &DynArgList
)
Used to construct a set of Components given a spawnable type. It is recommended that you use the spawnables! macro and SpawnableConfig trait to define this logic in separate modules.