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