frame-of-mind/src/logic-scenes/main menu/gameplay_settings.gd

40 lines
1.2 KiB
GDScript3
Raw Normal View History

extends VBoxContainer
signal changed
2024-10-07 09:16:18 +00:00
signal leave_stage
var has_stage:bool = false:
set(stage):
has_stage = stage
2024-10-07 09:16:18 +00:00
if is_node_ready() and has_stage:
y_switch.grab_focus()
var current_music_decay:float = 0
@onready var y_switch: CheckBox = %InvertY
@onready var input_sensitivity_slider: HSlider = %InputSensitivitySlider
@onready var stream_overlay_picker: OptionButton = %StreamOverlayPicker
func _ready() -> void:
update_ui_from_state()
y_switch.toggled.connect(func(value): State.inverty_y_axis = value)
input_sensitivity_slider.value_changed.connect(func(value): State.input_sensitivity = value)
stream_overlay_picker.item_selected.connect(func(value): State.stream_overlay = value)
%SaveButton.pressed.connect(_on_exit_button_pressed)
func update_ui_from_state():
y_switch.button_pressed = State.inverty_y_axis
input_sensitivity_slider.value = State.input_sensitivity
stream_overlay_picker.select(State.stream_overlay_position)
func _on_exit_button_pressed() -> void:
2024-10-07 09:16:18 +00:00
leave_stage.emit()
State.save_settings()
State.leave_stage(self)
func _input(event: InputEvent) -> void:
if event.is_action_pressed("ui_cancel") and has_stage:
State.leave_stage(self)