32 lines
593 B
Rust
32 lines
593 B
Rust
|
use bevy::prelude::*;
|
||
|
|
||
|
#[derive(Component)]
|
||
|
pub struct Settings {
|
||
|
pub mute_sfx: bool,
|
||
|
pub mute_music: bool,
|
||
|
pub volume_sfx: u8,
|
||
|
pub volume_music: u8,
|
||
|
}
|
||
|
|
||
|
impl Default for Settings {
|
||
|
fn default() -> Self {
|
||
|
Settings {
|
||
|
mute_sfx: false,
|
||
|
mute_music: false,
|
||
|
volume_sfx: 100,
|
||
|
volume_music: 100,
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
impl Settings {
|
||
|
pub fn reset(&mut self) {
|
||
|
println!("Resetting settings!");
|
||
|
*self = Self::default();
|
||
|
}
|
||
|
}
|
||
|
|
||
|
pub fn setup(mut commands: Commands) {
|
||
|
commands.spawn(Settings::default());
|
||
|
}
|