fly_b/
misc.rs

1pub use sect_pass::res::count::PassedSectCount;
2pub mod sect_pass;
3
4pub mod keybinds;
5
6pub use music::MusicPlugin;
7pub mod music {
8    use bevy::prelude::*;
9
10    #[derive(Default)]
11    pub struct MusicPlugin {
12        _priv_fields_placeholder: (),
13    }
14    impl Plugin for MusicPlugin {
15        fn build(&self, app: &mut App) {
16            app.init_asset::<AudioSource>()
17                .add_systems(Startup, sys::start_playing);
18        }
19    }
20    pub mod sys {
21        use bevy::prelude::*;
22
23        pub fn start_playing(mut cmds: Commands, asset_serv: Res<AssetServer>) {
24            cmds.spawn(AudioBundle {
25                source: asset_serv.load("sounds/Roa – Color.mp3"),
26                settings: PlaybackSettings::LOOP,
27            });
28        }
29    }
30}
31
32use self::sect_pass::SectPassPlugin;
33use crate::KeybindsPlugin;
34use bevy::{app::PluginGroupBuilder, prelude::*};
35
36/// Is meant to contain all the "miscellaneous" plugins.
37///
38/// These plugins can be configured, set from these interface,
39///  before running the simulation.
40#[allow(missing_docs)]
41#[derive(Default)]
42pub struct MiscPlugins {
43    pub sect_pass: SectPassPlugin,
44    pub keybinds: KeybindsPlugin,
45    pub music: MusicPlugin,
46}
47
48impl PluginGroup for MiscPlugins {
49    fn build(self) -> bevy::app::PluginGroupBuilder {
50        let Self {
51            sect_pass,
52            keybinds,
53            music,
54        } = self;
55        PluginGroupBuilder::start::<Self>()
56            .add(sect_pass)
57            .add(keybinds)
58            .add(music)
59    }
60}