outfly/src/settings.rs
2024-03-19 18:32:24 +01:00

60 lines
1.6 KiB
Rust

use bevy::prelude::*;
#[derive(Resource)]
pub struct Settings {
pub mute_sfx: bool,
pub mute_music: bool,
pub volume_sfx: u8,
pub volume_music: u8,
pub font_size_hud: f32,
pub font_size_conversations: f32,
pub hud_active: bool,
pub key_togglehud: KeyCode,
pub key_exit: KeyCode,
pub key_restart: KeyCode,
pub key_fullscreen: KeyCode,
pub key_forward: KeyCode,
pub key_back: KeyCode,
pub key_left: KeyCode,
pub key_right: KeyCode,
pub key_up: KeyCode,
pub key_down: KeyCode,
pub key_run: KeyCode,
pub key_stop: KeyCode,
pub key_interact: KeyCode,
}
impl Default for Settings {
fn default() -> Self {
Settings {
mute_sfx: false,
mute_music: false,
volume_sfx: 100,
volume_music: 100,
font_size_hud: 32.0,
font_size_conversations: 32.0,
hud_active: false,
key_togglehud: KeyCode::Tab,
key_exit: KeyCode::Escape,
key_restart: KeyCode::F12,
key_fullscreen: KeyCode::F11,
key_forward: KeyCode::KeyW,
key_back: KeyCode::KeyS,
key_left: KeyCode::KeyA,
key_right: KeyCode::KeyD,
key_up: KeyCode::ShiftLeft,
key_down: KeyCode::ControlLeft,
key_run: KeyCode::KeyR,
key_stop: KeyCode::Space,
key_interact: KeyCode::KeyE,
}
}
}
impl Settings {
pub fn reset(&mut self) {
println!("Resetting settings!");
*self = Self::default();
}
}