Skip to main content

Module settings

Module settings 

Source
Expand description

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

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);
}

Structs§

PersistedSettings
User-adjustable settings persisted to worlds/{world_name}/settings.json.