mirror of
https://github.com/doukutsu-rs/doukutsu-rs
synced 2024-11-16 10:52:44 +00:00
Debug mode config toggle
This commit is contained in:
parent
0c97d554ae
commit
b626472f10
|
@ -256,7 +256,6 @@ impl BackendEventLoop for SDL2EventLoop {
|
||||||
Event::KeyDown { scancode: Some(scancode), repeat, keymod, .. } => {
|
Event::KeyDown { scancode: Some(scancode), repeat, keymod, .. } => {
|
||||||
if let Some(drs_scan) = conv_scancode(scancode) {
|
if let Some(drs_scan) = conv_scancode(scancode) {
|
||||||
if !repeat {
|
if !repeat {
|
||||||
#[cfg(debug_assertions)]
|
|
||||||
state.process_debug_keys(drs_scan);
|
state.process_debug_keys(drs_scan);
|
||||||
|
|
||||||
if keymod.intersects(keyboard::Mod::RALTMOD | keyboard::Mod::LALTMOD)
|
if keymod.intersects(keyboard::Mod::RALTMOD | keyboard::Mod::LALTMOD)
|
||||||
|
|
|
@ -50,6 +50,7 @@ pub struct Settings {
|
||||||
pub locale: Language,
|
pub locale: Language,
|
||||||
#[serde(default = "default_vsync")]
|
#[serde(default = "default_vsync")]
|
||||||
pub vsync_mode: VSyncMode,
|
pub vsync_mode: VSyncMode,
|
||||||
|
pub debug_mode: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
fn default_true() -> bool {
|
fn default_true() -> bool {
|
||||||
|
@ -58,7 +59,7 @@ fn default_true() -> bool {
|
||||||
|
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
fn current_version() -> u32 {
|
fn current_version() -> u32 {
|
||||||
8
|
9
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
|
@ -138,6 +139,11 @@ impl Settings {
|
||||||
self.vsync_mode = default_vsync();
|
self.vsync_mode = default_vsync();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if self.version == 8 {
|
||||||
|
self.version = 9;
|
||||||
|
self.debug_mode = false;
|
||||||
|
}
|
||||||
|
|
||||||
if self.version != initial_version {
|
if self.version != initial_version {
|
||||||
log::info!("Upgraded configuration file from version {} to {}.", initial_version, self.version);
|
log::info!("Upgraded configuration file from version {} to {}.", initial_version, self.version);
|
||||||
}
|
}
|
||||||
|
@ -190,6 +196,7 @@ impl Default for Settings {
|
||||||
fps_counter: false,
|
fps_counter: false,
|
||||||
locale: Language::English,
|
locale: Language::English,
|
||||||
vsync_mode: VSyncMode::VSync,
|
vsync_mode: VSyncMode::VSync,
|
||||||
|
debug_mode: false,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -404,6 +404,10 @@ impl SharedGameState {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn process_debug_keys(&mut self, key_code: ScanCode) {
|
pub fn process_debug_keys(&mut self, key_code: ScanCode) {
|
||||||
|
if !self.settings.debug_mode {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
match key_code {
|
match key_code {
|
||||||
ScanCode::F3 => self.settings.god_mode = !self.settings.god_mode,
|
ScanCode::F3 => self.settings.god_mode = !self.settings.god_mode,
|
||||||
ScanCode::F4 => self.settings.infinite_booster = !self.settings.infinite_booster,
|
ScanCode::F4 => self.settings.infinite_booster = !self.settings.infinite_booster,
|
||||||
|
|
Loading…
Reference in a new issue