Add maximized option for windowmode
This commit is contained in:
parent
a5f927865c
commit
86a8d998b4
@ -6,7 +6,7 @@ use std::{
|
||||
use godot::{
|
||||
classes::{
|
||||
AudioServer, DisplayServer, FileAccess, InputEvent, InputEventKey, InputEventMouseButton,
|
||||
InputMap, display_server::WindowMode, file_access::ModeFlags,
|
||||
InputMap, display_server::WindowMode, file_access::ModeFlags, window::Mode,
|
||||
},
|
||||
global::{Key, MouseButton},
|
||||
prelude::*,
|
||||
@ -60,6 +60,7 @@ pub enum WindowModeSetting {
|
||||
Fullscreen = 0,
|
||||
BorderlessFullscreen,
|
||||
Windowed,
|
||||
Maximized,
|
||||
}
|
||||
|
||||
impl TryFrom<usize> for WindowModeSetting {
|
||||
@ -70,6 +71,7 @@ impl TryFrom<usize> for WindowModeSetting {
|
||||
0 => Ok(WindowModeSetting::Fullscreen),
|
||||
1 => Ok(WindowModeSetting::BorderlessFullscreen),
|
||||
2 => Ok(WindowModeSetting::Windowed),
|
||||
3 => Ok(WindowModeSetting::Maximized),
|
||||
_ => Err(()),
|
||||
}
|
||||
}
|
||||
@ -149,7 +151,7 @@ impl Default for GameSettings {
|
||||
default_name: "Default McGee".to_owned(),
|
||||
replay_fps: 60,
|
||||
render_scale: 1.,
|
||||
window_mode: WindowModeSetting::Windowed,
|
||||
window_mode: WindowModeSetting::Maximized,
|
||||
recent_servers: Vec::new(),
|
||||
volume: VolumeSettings {
|
||||
master_volume: 100.,
|
||||
@ -281,6 +283,7 @@ impl GameSettingsManager {
|
||||
WindowModeSetting::Fullscreen => WindowMode::EXCLUSIVE_FULLSCREEN,
|
||||
WindowModeSetting::BorderlessFullscreen => WindowMode::EXCLUSIVE_FULLSCREEN,
|
||||
WindowModeSetting::Windowed => WindowMode::WINDOWED,
|
||||
WindowModeSetting::Maximized => WindowMode::MAXIMIZED,
|
||||
};
|
||||
DisplayServer::singleton().window_set_mode(window_mode);
|
||||
}
|
||||
|
||||
@ -325,6 +325,7 @@ impl SettingsPanel {
|
||||
SettingValue::OptionSetting(selected, _) => {
|
||||
if let Ok(mut button) = control.try_cast::<OptionButton>() {
|
||||
button.select(selected as i32);
|
||||
self.on_change(setting, new_value);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -465,6 +466,10 @@ fn settings_from(map: &mut HashMap<Setting, SettingValue>, settings: &GameSettin
|
||||
value: WindowModeSetting::Windowed as usize,
|
||||
text: "Windowed".to_string(),
|
||||
},
|
||||
OptionSetting {
|
||||
value: WindowModeSetting::Maximized as usize,
|
||||
text: "Maximized".to_string(),
|
||||
},
|
||||
],
|
||||
),
|
||||
);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user