diff --git a/examples/audio_control.rs b/examples/audio_control.rs index d268ff5..e093989 100644 --- a/examples/audio_control.rs +++ b/examples/audio_control.rs @@ -19,7 +19,7 @@ fn main() { "./assets/audio/demo_project/Build/Desktop/Music.bank", ]), )) - .add_systems(Startup, startup) + .add_systems(Startup, (startup, display_controls)) .add_systems(PostStartup, play_music) .add_systems(Update, audio_control) .run(); @@ -35,6 +35,9 @@ fn startup(mut commands: Commands, studio: Res) { event_instance: event_description.create_instance().unwrap(), despawn_stop_mode: StopMode::AllowFadeout, }); + + // In this case only needed to show the controls: + commands.spawn(Camera2dBundle::default()); } fn play_music(mut audio_sources: Query<&AudioSource, With>) { @@ -60,3 +63,12 @@ fn audio_control(query: Query<&AudioSource>, input: Res>) { } } } + +fn display_controls(mut commands: Commands) { + commands.spawn(TextBundle::from_sections([ + TextSection::from("Controls: \n"), + TextSection::from("S: Stop \n"), + TextSection::from("P: Play \n"), + TextSection::from("T: Toggle \n"), + ])); +} diff --git a/examples/parameters.rs b/examples/parameters.rs index f828d37..9788b2b 100644 --- a/examples/parameters.rs +++ b/examples/parameters.rs @@ -48,7 +48,7 @@ fn main() { "./assets/audio/demo_project/Build/Desktop/SFX.bank", ]), )) - .add_systems(Startup, startup) + .add_systems(Startup, (startup, display_controls)) .add_systems(PostStartup, play_music) .add_systems(Update, (set_rain, set_hour)) .run(); @@ -74,6 +74,9 @@ fn startup(mut commands: Commands, studio: Res) { event_instance: event_description.create_instance().unwrap(), despawn_stop_mode: StopMode::AllowFadeout, }); + + // In this case only needed to show the controls: + commands.spawn(Camera2dBundle::default()); } fn play_music(audio_sources: Query<&AudioSource>) { @@ -123,3 +126,13 @@ fn set_hour( } } } + +fn display_controls(mut commands: Commands) { + commands.spawn(TextBundle::from_sections([ + TextSection::from("Controls: \n"), + TextSection::from("Arrow Up: Increase Rain \n"), + TextSection::from("Arrow Down: Decrease Rain \n"), + TextSection::from("E: Change time to Evening \n"), + TextSection::from("M: Change time to Morning \n"), + ])); +} diff --git a/examples/spatial.rs b/examples/spatial.rs index 29e84e9..52342e5 100644 --- a/examples/spatial.rs +++ b/examples/spatial.rs @@ -19,7 +19,7 @@ fn main() { "./assets/audio/demo_project/Build/Desktop/Music.bank", ]), )) - .add_systems(Startup, setup_scene) + .add_systems(Startup, (setup_scene, display_controls)) .add_systems(PostStartup, play_music) .add_systems(Update, orbit_audio_source) .add_systems(Update, update_listener) @@ -112,3 +112,9 @@ fn update_listener( transform.translation.z -= speed * time.delta_seconds(); } } + +fn display_controls(mut commands: Commands) { + commands.spawn(TextBundle::from( + "Controls: Use the arrow keys to move around", + )); +} diff --git a/src/components/bundles.rs b/src/components/bundles.rs index 609f881..ca050d9 100644 --- a/src/components/bundles.rs +++ b/src/components/bundles.rs @@ -20,7 +20,7 @@ impl SpatialAudioBundle { /// # Arguments /// /// * `event_description` - An [`EventDescription`] that provides the necessary information to - /// create an [`AudioSource`]. + /// create an [`AudioSource`]. /// /// # Returns ///