options menu courtesy of noelle/pizzaperp

This commit is contained in:
Persephone Bubblegum-Holiday 2025-08-12 21:42:43 -07:00
parent 8f34c0ff71
commit 4c4299a6df
9 changed files with 322 additions and 3 deletions

View file

@ -7,6 +7,13 @@ func _ready():
$Backgrounds.get_child(randi() % $Backgrounds.get_child_count()).visible = true
$Buttons/EditorButton.grab_focus()
Globalvariables.loadConfig()
print(Globalvariables.FOV)
print(Globalvariables.msaa)
$SettingsScreen/DialogPanel/GraphicsPanel/HBoxContainer/settings/fov_slider.value = Globalvariables.FOV
$SettingsScreen/DialogPanel/GraphicsPanel/HBoxContainer/settings/option_aa_msaa.selected = Globalvariables.msaa
$SettingsScreen/DialogPanel/GraphicsPanel/HBoxContainer/settings/option_aa_ss.selected = Globalvariables.ssaa
var moddir = DirAccess.open("user://Mods")
if moddir == null:
print("Mod folder was not found. Creating.")
@ -41,6 +48,7 @@ func _on_button_pressed() -> void:
get_tree().change_scene_to_file("res://Scenes/GUI/EditorScreen.tscn")
func _on_exit_button_pressed() -> void:
Globalvariables.updateConfig()
get_tree().quit()
func _on_credits_button_pressed() -> void:
@ -55,11 +63,16 @@ func _on_free_roam_button_pressed() -> void:
func _on_mods_button_pressed() -> void:
$ModsScreen.visible = true
func _on_settings_button_pressed() -> void:
$SettingsScreen.visible = true
func _on_input_eater_pressed() -> void:
Globalvariables.updateConfig()
$CreditsScreen.visible = false
$ControlsScreen.visible = false
$FreeRoamChooseScreen.visible = false
$ModsScreen.visible = false
$SettingsScreen.visible = false
func _input(event: InputEvent) -> void:
if event.is_action_pressed("fullscreen"):

View file

@ -63,6 +63,10 @@ func _unhandled_input(event: InputEvent) -> void:
elif event.is_action_pressed(&"freeroam_debug_menu"):
$DebugMenu.visible = !$DebugMenu.visible
func _process(delta: float) -> void:
if ($Camera.fov != Globalvariables.FOV):
$Camera.fov = Globalvariables.FOV
func _physics_process(delta: float) -> void:
if (interact):
if Input.is_action_just_pressed(&"freeroam_jump"): jumping = true

View file

@ -0,0 +1,44 @@
extends Node
var FOV = 80
var config = ConfigFile.new()
var msaa = 1
var ssaa = 1
func _ready() -> void:
msaa = get_viewport().msaa_3d
ssaa = get_viewport().screen_space_aa
func updateConfig():
msaa = get_viewport().msaa_3d
ssaa = get_viewport().screen_space_aa
config.set_value("GRAPHICS", "fov", FOV)
config.set_value("GRAPHICS", "msaa", msaa)
config.set_value("GRAPHICS", "ssaa", ssaa)
config.save("user://settings.cfg")
func loadConfig():
var err = config.load("user://settings.cfg")
print("loading config...")
if err != OK:
print("Couldn't load config!")
return
FOV = config.get_value("GRAPHICS", "fov")
msaa = config.get_value("GRAPHICS", "msaa")
ssaa = config.get_value("GRAPHICS", "ssaa")
print("config loaded.")
# set msaa
var index = msaa
if index == 0: # Disabled
get_viewport().msaa_3d = Viewport.MSAA_DISABLED
elif index == 1: # 2×
get_viewport().msaa_3d = Viewport.MSAA_2X
elif index == 2: # 4×
get_viewport().msaa_3d = Viewport.MSAA_4X
elif index == 3: # 8×
get_viewport().msaa_3d = Viewport.MSAA_8X
# set ssaa
get_viewport().screen_space_aa = int(index == 1) as Viewport.ScreenSpaceAA

View file

@ -0,0 +1 @@
uid://dfafaty8dlmgj