mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Merge branch 'juliancoffee/egui_setting' into 'master'
Egui toggle See merge request veloren/veloren!2742
This commit is contained in:
commit
fab5c54253
@ -21,6 +21,7 @@
|
||||
"gameinput.help": "Toggle Help Window",
|
||||
"gameinput.toggleinterface": "Toggle Interface",
|
||||
"gameinput.toggledebug": "Toggle FPS and Debug Info",
|
||||
"gameinput.toggle_egui_debug": "Toggle EGUI Debug Info",
|
||||
"gameinput.togglechat": "Toggle Chat",
|
||||
"gameinput.screenshot": "Take Screenshot",
|
||||
"gameinput.toggleingameui": "Toggle Nametags",
|
||||
|
@ -14,7 +14,7 @@ use core::mem;
|
||||
use egui::{
|
||||
plot::{Plot, Value},
|
||||
widgets::plot::Curve,
|
||||
CollapsingHeader, Color32, Grid, Label, ScrollArea, Slider, Ui, Window,
|
||||
CollapsingHeader, Color32, Grid, Label, Pos2, ScrollArea, Slider, Ui, Window,
|
||||
};
|
||||
|
||||
fn two_col_row(ui: &mut Ui, label: impl Into<Label>, content: impl Into<Label>) {
|
||||
@ -202,7 +202,9 @@ pub fn maintain_egui_inner(
|
||||
}
|
||||
};
|
||||
|
||||
let start_pos = Pos2 { x: 300.0, y: 0.0 };
|
||||
egui::Window::new("Debug Control")
|
||||
.default_pos(start_pos)
|
||||
.default_width(200.0)
|
||||
.default_height(200.0)
|
||||
.show(&platform.context(), |ui| {
|
||||
|
@ -150,6 +150,10 @@ impl From<&crate::settings::GamepadSettings> for ControllerSettings {
|
||||
map.entry(settings.game_buttons.toggle_debug)
|
||||
.or_default()
|
||||
.push(GameInput::ToggleDebug);
|
||||
#[cfg(feature = "egui-ui")]
|
||||
map.entry(settings.game_buttons.toggle_debug)
|
||||
.or_default()
|
||||
.push(GameInput::ToggleEguiDebug);
|
||||
map.entry(settings.game_buttons.toggle_chat)
|
||||
.or_default()
|
||||
.push(GameInput::ToggleChat);
|
||||
|
@ -106,6 +106,9 @@ pub enum GameInput {
|
||||
Help,
|
||||
#[strum(serialize = "gameinput.toggledebug")]
|
||||
ToggleDebug,
|
||||
#[cfg(feature = "egui-ui")]
|
||||
#[strum(serialize = "gameinput.toggle_egui_debug")]
|
||||
ToggleEguiDebug,
|
||||
#[strum(serialize = "gameinput.togglechat")]
|
||||
ToggleChat,
|
||||
#[strum(serialize = "gameinput.fullscreen")]
|
||||
|
@ -3656,6 +3656,12 @@ impl Hud {
|
||||
self.show.debug = global_state.settings.interface.toggle_debug;
|
||||
true
|
||||
},
|
||||
#[cfg(feature = "egui-ui")]
|
||||
GameInput::ToggleEguiDebug if state => {
|
||||
global_state.settings.interface.toggle_egui_debug =
|
||||
!global_state.settings.interface.toggle_egui_debug;
|
||||
true
|
||||
},
|
||||
GameInput::ToggleChat if state => {
|
||||
global_state.settings.interface.toggle_chat =
|
||||
!global_state.settings.interface.toggle_chat;
|
||||
|
@ -196,7 +196,10 @@ fn handle_main_events_cleared(
|
||||
last.render(&mut drawer, &global_state.settings);
|
||||
|
||||
#[cfg(feature = "egui-ui")]
|
||||
if last.egui_enabled() && global_state.settings.interface.toggle_debug {
|
||||
if last.egui_enabled()
|
||||
&& global_state.settings.interface.toggle_debug
|
||||
&& global_state.settings.interface.toggle_egui_debug
|
||||
{
|
||||
drawer.draw_egui(&mut global_state.egui_state.platform, scale_factor);
|
||||
}
|
||||
};
|
||||
|
@ -144,6 +144,8 @@ impl ControlSettings {
|
||||
GameInput::Help => KeyMouse::Key(VirtualKeyCode::F1),
|
||||
GameInput::ToggleInterface => KeyMouse::Key(VirtualKeyCode::F2),
|
||||
GameInput::ToggleDebug => KeyMouse::Key(VirtualKeyCode::F3),
|
||||
#[cfg(feature = "egui-ui")]
|
||||
GameInput::ToggleEguiDebug => KeyMouse::Key(VirtualKeyCode::F7),
|
||||
GameInput::ToggleChat => KeyMouse::Key(VirtualKeyCode::F5),
|
||||
GameInput::Fullscreen => KeyMouse::Key(VirtualKeyCode::F11),
|
||||
GameInput::Screenshot => KeyMouse::Key(VirtualKeyCode::F4),
|
||||
|
@ -77,6 +77,8 @@ pub mod con_settings {
|
||||
pub help: Button,
|
||||
pub toggle_interface: Button,
|
||||
pub toggle_debug: Button,
|
||||
#[cfg(feature = "egui-ui")]
|
||||
pub toggle_egui_debug: Button,
|
||||
pub toggle_chat: Button,
|
||||
pub fullscreen: Button,
|
||||
pub screenshot: Button,
|
||||
@ -168,6 +170,8 @@ pub mod con_settings {
|
||||
help: Button::Simple(GilButton::Unknown),
|
||||
toggle_interface: Button::Simple(GilButton::Unknown),
|
||||
toggle_debug: Button::Simple(GilButton::Unknown),
|
||||
#[cfg(feature = "egui-ui")]
|
||||
toggle_egui_debug: Button::Simple(GilButton::Unknown),
|
||||
toggle_chat: Button::Simple(GilButton::Unknown),
|
||||
fullscreen: Button::Simple(GilButton::Unknown),
|
||||
screenshot: Button::Simple(GilButton::Unknown),
|
||||
|
@ -10,6 +10,7 @@ use vek::*;
|
||||
#[serde(default)]
|
||||
pub struct InterfaceSettings {
|
||||
pub toggle_debug: bool,
|
||||
pub toggle_egui_debug: bool,
|
||||
pub toggle_hitboxes: bool,
|
||||
pub toggle_chat: bool,
|
||||
pub sct: bool,
|
||||
@ -46,6 +47,7 @@ impl Default for InterfaceSettings {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
toggle_debug: false,
|
||||
toggle_egui_debug: false,
|
||||
toggle_hitboxes: false,
|
||||
toggle_chat: true,
|
||||
sct: true,
|
||||
|
Loading…
Reference in New Issue
Block a user