This commit is contained in:
team3
2026-09-16 13:21:45 +02:00
parent 8a188c5d5c
commit 49e8f2d95e
27 changed files with 1772 additions and 265 deletions

24
scripts/core/Settings.gd Normal file
View File

@@ -0,0 +1,24 @@
class_name Settings
extends RefCounted
## Lautstärke und Schwierigkeit in user://settings.cfg.
const PATH := "user://settings.cfg"
var volume: float = 0.8
var difficulty: int = Data.Difficulty.NORMAL
func load_from_disk(path: String = PATH) -> void:
var cfg := ConfigFile.new()
if cfg.load(path) != OK:
return
volume = clampf(float(cfg.get_value("audio", "volume", volume)), 0.0, 1.0)
difficulty = clampi(int(cfg.get_value("game", "difficulty", difficulty)), 0, 2)
func save_to_disk(path: String = PATH) -> void:
var cfg := ConfigFile.new()
cfg.set_value("audio", "volume", volume)
cfg.set_value("game", "difficulty", difficulty)
cfg.save(path)