2024-03-16 21:20:23 +00:00
|
|
|
use bevy::prelude::*;
|
|
|
|
|
2024-03-17 17:26:44 +00:00
|
|
|
#[derive(Resource)]
|
2024-03-16 21:20:23 +00:00
|
|
|
pub struct Settings {
|
|
|
|
pub mute_sfx: bool,
|
|
|
|
pub mute_music: bool,
|
|
|
|
pub volume_sfx: u8,
|
|
|
|
pub volume_music: u8,
|
2024-03-17 19:31:16 +00:00
|
|
|
pub font_size_hud: f32,
|
|
|
|
pub font_size_conversations: f32,
|
2024-03-17 21:28:10 +00:00
|
|
|
pub hud_active: bool,
|
2024-03-18 03:39:26 +00:00
|
|
|
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,
|
2024-03-19 00:24:27 +00:00
|
|
|
pub key_interact: KeyCode,
|
2024-03-20 01:03:42 +00:00
|
|
|
pub key_reply1: KeyCode,
|
|
|
|
pub key_reply2: KeyCode,
|
|
|
|
pub key_reply3: KeyCode,
|
|
|
|
pub key_reply4: KeyCode,
|
|
|
|
pub key_reply5: KeyCode,
|
|
|
|
pub key_reply6: KeyCode,
|
|
|
|
pub key_reply7: KeyCode,
|
|
|
|
pub key_reply8: KeyCode,
|
|
|
|
pub key_reply9: KeyCode,
|
|
|
|
pub key_reply10: KeyCode,
|
2024-03-16 21:20:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
impl Default for Settings {
|
|
|
|
fn default() -> Self {
|
|
|
|
Settings {
|
2024-03-21 01:11:07 +00:00
|
|
|
mute_sfx: true,
|
|
|
|
mute_music: true,
|
2024-03-16 21:20:23 +00:00
|
|
|
volume_sfx: 100,
|
|
|
|
volume_music: 100,
|
2024-03-17 19:31:16 +00:00
|
|
|
font_size_hud: 32.0,
|
|
|
|
font_size_conversations: 32.0,
|
2024-03-18 01:15:44 +00:00
|
|
|
hud_active: false,
|
2024-03-18 03:39:26 +00:00
|
|
|
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,
|
2024-03-19 00:24:27 +00:00
|
|
|
key_interact: KeyCode::KeyE,
|
2024-03-20 01:03:42 +00:00
|
|
|
key_reply1: KeyCode::Digit1,
|
|
|
|
key_reply2: KeyCode::Digit2,
|
|
|
|
key_reply3: KeyCode::Digit3,
|
|
|
|
key_reply4: KeyCode::Digit4,
|
|
|
|
key_reply5: KeyCode::Digit5,
|
|
|
|
key_reply6: KeyCode::Digit6,
|
|
|
|
key_reply7: KeyCode::Digit7,
|
|
|
|
key_reply8: KeyCode::Digit8,
|
|
|
|
key_reply9: KeyCode::Digit9,
|
|
|
|
key_reply10: KeyCode::Digit0,
|
2024-03-16 21:20:23 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
impl Settings {
|
|
|
|
pub fn reset(&mut self) {
|
|
|
|
println!("Resetting settings!");
|
|
|
|
*self = Self::default();
|
|
|
|
}
|
2024-03-20 01:03:42 +00:00
|
|
|
|
|
|
|
pub fn get_reply_keys(&self) -> [KeyCode; 10] {
|
|
|
|
return [
|
|
|
|
self.key_reply1,
|
|
|
|
self.key_reply2,
|
|
|
|
self.key_reply3,
|
|
|
|
self.key_reply4,
|
|
|
|
self.key_reply5,
|
|
|
|
self.key_reply6,
|
|
|
|
self.key_reply7,
|
|
|
|
self.key_reply8,
|
|
|
|
self.key_reply9,
|
|
|
|
self.key_reply10,
|
|
|
|
];
|
|
|
|
}
|
2024-03-16 21:20:23 +00:00
|
|
|
}
|