1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
//! Persistent user settings saved to `worlds/{world_name}/settings.json`.
//!
//! [`PersistedSettings`] captures the four in-game slider values (FOV, SFX
//! volume, render distance, mouse sensitivity) and writes them to disk when the
//! player closes the Settings menu. On next launch the game reads this file and
//! patches the config resources before inserting them, so the player's choices
//! survive across sessions.
//!
//! # Usage
//!
//! ```rust,no_run
//! use voxel_framework::settings::PersistedSettings;
//!
//! // Save
//! let settings = PersistedSettings {
//! fov_degrees: 90.0,
//! sfx_volume: 0.8,
//! render_distance_chunks: 10,
//! sensitivity_pct: 100,
//! };
//! settings.save("my_world");
//!
//! // Load
//! if let Some(saved) = PersistedSettings::load("my_world") {
//! println!("Loaded FOV: {}", saved.fov_degrees);
//! }
//! ```
use ;
/// User-adjustable settings persisted to `worlds/{world_name}/settings.json`.
///
/// All four fields map directly to the in-game sliders exposed by
/// [`crate::ui::PauseMenuPlugin`]:
///
/// | Field | Slider | Range |
/// |-------|--------|-------|
/// | `fov_degrees` | Field of View | 50–120 |
/// | `sfx_volume` | SFX Volume | 0.0–1.0 |
/// | `render_distance_chunks` | Render Distance | 4–32 (even) |
/// | `sensitivity_pct` | Mouse Sensitivity | 10–100 |