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 map_show_quests: bool,
53    pub minimap_show: bool,
54    pub minimap_face_north: bool,
55    pub minimap_zoom: f64,
56    pub minimap_scale: f64,
57    pub minimap_colored_player_marker: bool,
58    pub accum_experience: bool,
59    pub xp_bar_skillgroup: Option<SkillGroupKind>,
60    pub row_background_opacity: f32,
61}
62
63impl Default for InterfaceSettings {
64    fn default() -> Self {
65        Self {
66            toggle_debug: false,
67            toggle_egui_debug: false,
68            toggle_hitboxes: false,
69            toggle_chat: true,
70            toggle_hotkey_hints: true,
71            slots_use_prefixes: true,
72            slots_prefix_switch_point: 5,
73            sct: true,
74            sct_damage_rounding: false,
75            sct_dmg_accum_duration: 0.45,
76            sct_inc_dmg: true,
77            sct_inc_dmg_accum_duration: 0.45,
78            speech_bubble_self: true,
79            speech_bubble_dark_mode: false,
80            speech_bubble_icon: true,
81            crosshair_opacity: 0.6,
82            crosshair_type: CrosshairType::Round,
83            intro_show: Intro::Show,
84            xp_bar: XpBar::Always,
85            shortcut_numbers: ShortcutNumbers::On,
86            buff_position: BuffPosition::Bar,
87            bar_numbers: BarNumbers::Values,
88            always_show_bars: false,
89            enable_poise_bar: true,
90            use_health_prefixes: true,
91            ui_scale: ScaleMode::RelativeToWindow([1920.0, 1080.0].into()),
92            map_zoom: 10.0,
93            map_show_topo_map: true,
94            map_show_difficulty: true,
95            map_show_towns: true,
96            map_show_dungeons: true,
97            map_show_castles: false,
98            map_show_bridges: false,
99            map_show_glider_courses: false,
100            loading_tips: true,
101            map_show_caves: true,
102            map_show_trees: false,
103            map_show_peaks: false,
104            map_show_biomes: false,
105            map_show_voxel_map: true,
106            map_show_quests: true,
107            minimap_show: true,
108            minimap_face_north: true,
109            minimap_zoom: 160.0,
110            minimap_scale: 1.5,
111            minimap_colored_player_marker: false,
112            accum_experience: true,
113            xp_bar_skillgroup: Some(SkillGroupKind::General),
114            row_background_opacity: 0.025,
115        }
116    }
117}
118
119#[cfg(feature = "egui-ui")]
120impl InterfaceSettings {
121    pub fn egui_enabled(&self) -> bool { self.toggle_egui_debug }
122}