veloren_voxygen/settings/
interface.rs

1use crate::{
2    hud::{BarNumbers, BuffPosition, CrosshairType, Intro, ShortcutNumbers, XpBar},
3    ui::ScaleMode,
4};
5use common::comp::skillset::SkillGroupKind;
6use serde::{Deserialize, Serialize};
7
8/// `InterfaceSettings` contains UI, HUD and Map options.
9#[derive(Clone, Debug, Serialize, Deserialize)]
10#[serde(default)]
11pub struct InterfaceSettings {
12    pub toggle_debug: bool,
13    pub toggle_egui_debug: bool,
14    pub toggle_hitboxes: bool,
15    pub toggle_chat: bool,
16    pub toggle_hotkey_hints: bool,
17    pub slots_use_prefixes: bool,
18    pub slots_prefix_switch_point: u32,
19    pub sct: bool,
20    pub sct_damage_rounding: bool,
21    pub sct_dmg_accum_duration: f32,
22    pub sct_inc_dmg: bool,
23    pub sct_inc_dmg_accum_duration: f32,
24    pub speech_bubble_self: bool,
25    pub speech_bubble_dark_mode: bool,
26    pub speech_bubble_icon: bool,
27    pub crosshair_opacity: f32,
28    pub crosshair_type: CrosshairType,
29    pub intro_show: Intro,
30    pub xp_bar: XpBar,
31    pub shortcut_numbers: ShortcutNumbers,
32    pub buff_position: BuffPosition,
33    pub bar_numbers: BarNumbers,
34    pub always_show_bars: bool,
35    pub enable_poise_bar: bool,
36    pub use_health_prefixes: bool,
37    pub ui_scale: ScaleMode,
38    pub map_zoom: f64,
39    pub map_show_topo_map: bool,
40    pub map_show_difficulty: bool,
41    pub map_show_towns: bool,
42    pub map_show_dungeons: bool,
43    pub map_show_castles: bool,
44    pub map_show_bridges: bool,
45    pub map_show_glider_courses: bool,
46    pub loading_tips: bool,
47    pub map_show_caves: bool,
48    pub map_show_trees: bool,
49    pub map_show_peaks: bool,
50    pub map_show_biomes: bool,
51    pub map_show_voxel_map: bool,
52    pub minimap_show: bool,
53    pub minimap_face_north: bool,
54    pub minimap_zoom: f64,
55    pub accum_experience: bool,
56    pub xp_bar_skillgroup: Option<SkillGroupKind>,
57}
58
59impl Default for InterfaceSettings {
60    fn default() -> Self {
61        Self {
62            toggle_debug: false,
63            toggle_egui_debug: false,
64            toggle_hitboxes: false,
65            toggle_chat: true,
66            toggle_hotkey_hints: true,
67            slots_use_prefixes: true,
68            slots_prefix_switch_point: 5,
69            sct: true,
70            sct_damage_rounding: false,
71            sct_dmg_accum_duration: 0.45,
72            sct_inc_dmg: true,
73            sct_inc_dmg_accum_duration: 0.45,
74            speech_bubble_self: true,
75            speech_bubble_dark_mode: false,
76            speech_bubble_icon: true,
77            crosshair_opacity: 0.6,
78            crosshair_type: CrosshairType::Round,
79            intro_show: Intro::Show,
80            xp_bar: XpBar::Always,
81            shortcut_numbers: ShortcutNumbers::On,
82            buff_position: BuffPosition::Bar,
83            bar_numbers: BarNumbers::Values,
84            always_show_bars: false,
85            enable_poise_bar: true,
86            use_health_prefixes: true,
87            ui_scale: ScaleMode::RelativeToWindow([1920.0, 1080.0].into()),
88            map_zoom: 10.0,
89            map_show_topo_map: true,
90            map_show_difficulty: true,
91            map_show_towns: true,
92            map_show_dungeons: true,
93            map_show_castles: false,
94            map_show_bridges: false,
95            map_show_glider_courses: false,
96            loading_tips: true,
97            map_show_caves: true,
98            map_show_trees: false,
99            map_show_peaks: false,
100            map_show_biomes: false,
101            map_show_voxel_map: true,
102            minimap_show: true,
103            minimap_face_north: true,
104            minimap_zoom: 160.0,
105            accum_experience: true,
106            xp_bar_skillgroup: Some(SkillGroupKind::General),
107        }
108    }
109}
110
111#[cfg(feature = "egui-ui")]
112impl InterfaceSettings {
113    pub fn egui_enabled(&self) -> bool { self.toggle_egui_debug }
114}