- select screen portraits load via pck-safe loader (the blank-cards bug in the shipped build) - Settings (title menu + persisted user://settings.json): fullscreen, hitbox viewer default, master volume - Esc: pause menu in fights (resume/rematch/select/menu), back-to-title from select/editor/settings - FOITIN_SHOT env hook smoke-tests exported builds end-to-end Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
31 lines
1.0 KiB
GDScript
31 lines
1.0 KiB
GDScript
class_name Settings
|
|
## Persistent app settings (user://settings.json). Apply on boot and on save.
|
|
|
|
static var fullscreen := false
|
|
static var show_boxes := false
|
|
static var volume := 80.0 # master, 0..100
|
|
|
|
static func load_and_apply() -> void:
|
|
var text := FileAccess.get_file_as_string("user://settings.json")
|
|
if not text.is_empty():
|
|
var d = JSON.parse_string(text)
|
|
if d is Dictionary:
|
|
fullscreen = bool(d.get("fullscreen", fullscreen))
|
|
show_boxes = bool(d.get("show_boxes", show_boxes))
|
|
volume = float(d.get("volume", volume))
|
|
apply()
|
|
|
|
static func save() -> void:
|
|
var f := FileAccess.open("user://settings.json", FileAccess.WRITE)
|
|
f.store_string(JSON.stringify({
|
|
"fullscreen": fullscreen, "show_boxes": show_boxes, "volume": volume,
|
|
}, " "))
|
|
f.close()
|
|
apply()
|
|
|
|
static func apply() -> void:
|
|
DisplayServer.window_set_mode(
|
|
DisplayServer.WINDOW_MODE_FULLSCREEN if fullscreen
|
|
else DisplayServer.WINDOW_MODE_WINDOWED)
|
|
AudioServer.set_bus_volume_db(0, linear_to_db(clampf(volume / 100.0, 0.0, 1.0)))
|