class_name SettingsMenu
extends Panel


@export_group("Graphics Settings Nodes")
@export var resolution_input: OptionButton
@export var fullscreen_input: CheckBox
@export var vsync_input: CheckBox
@export var fov_slider: HSlider
@export var fov_value_label: Label


#region Game Settings
func _on_block_highlighting_toggled(toggled_on: bool) -> void:
	GameSettingsManager.game_options_block_highlight_changed.emit(toggled_on)

func _on_enable_waila_toggled(toggled_on: bool) -> void:
	GameSettingsManager.game_options_waila_changed.emit(toggled_on)
#endregion

#region Graphics Settings
func _on_fov_slider_changed(value: float) -> void:
	fov_value_label.text = str(int(value))
	GameSettingsManager.graphics_fov_changed.emit(int(fov_slider.value))

func _on_graphics_apply_button_pressed() -> void:
	var values: Array = resolution_input.text.split_floats("x")
	var id: int = resolution_input.get_selected_id()

	GameSettingsManager.graphics_resolution_changed.emit(Vector2i(values[0], values[1]), id)
	GameSettingsManager.graphics_fullscreen_changed.emit(fullscreen_input.button_pressed)
	GameSettingsManager.graphics_vsync_changed.emit(vsync_input.button_pressed)
	GameSettingsManager.apply_graphics_settings.emit()
#endregion

#region Audio Settings
#endregion

#region Input Settings
#endregion


func _on_close_button_pressed() -> void:
	SignalManager.resume_game.emit()