FunkPanion/scripts/config/config_presets.gd

31 lines
748 B
GDScript

extends Button
var config_presets = preload("res://scenes/config_presets.tscn")
@onready var root = get_tree().root
@onready var form = $"../.."
func _pressed() -> void:
var preset_window = Popup.new()
var cfps = config_presets.instantiate()
cfps.conf_reference = form.temp_config
preset_window.add_child(cfps)
root.add_child(preset_window)
preset_window.popup_centered_ratio()
var close = func():
preset_window.hide()
root.remove_child(preset_window)
preset_window.queue_free()
cfps.queue_free()
cfps.reset.connect(func():
GlobalConfig.reset_settings()
close.call()
get_tree().reload_current_scene()
)
cfps.close.connect(close)
cfps.preset_use.connect(func():
close.call()
get_tree().reload_current_scene()
)