[gd_scene load_steps=3 format=3 uid="uid://gmxenhavh1lp"]

[ext_resource type="Script" path="res://logic-scenes/main menu/video_settings.gd" id="1_sii8g"]

[sub_resource type="GDScript" id="GDScript_24hb5"]
script/source = "@tool
extends SpinBox

func reset():
	value = 1

var normal_stylebox:StyleBoxFlat = get_line_edit().get_theme_stylebox(\"normal\")
var focus_stylebox:StyleBoxFlat
var edit_stylebox:StyleBoxFlat
@export var hold_down_delay: float = 0.5
@export var repeat_delay: float = 0.1
@export_range(1, 100) var repeat_multiplier: int = 1

@export var pressed: bool = false:
	set(value):
		pressed = value
		if pressed:
			prefix = \"<\"
			suffix = \">\"
			get_line_edit().add_theme_stylebox_override(\"normal\", edit_stylebox)
		else:
			prefix = \"  \"
			suffix = \"  \"
			get_line_edit().add_theme_stylebox_override(\"normal\", focus_stylebox)

func _ready() -> void:
	edit_stylebox = normal_stylebox.duplicate(true)
	edit_stylebox.bg_color = Color(\"#022635\")
	
	focus_stylebox = normal_stylebox.duplicate(true)
	focus_stylebox.border_width_bottom = 2
	focus_stylebox.border_width_left = 2
	focus_stylebox.border_width_right = 2
	focus_stylebox.border_width_top = 2
	focus_stylebox.border_color = Color.WHITE
	
	focus_entered.connect(_on_focus_enter)
	focus_exited.connect(_on_focus_exit)

func _input(event: InputEvent) -> void:
	if has_focus():
		if Input.is_action_just_pressed(\"ui_accept\"):
			print(\"pressed!\")
			print(pressed)
			pressed = not pressed
			print(pressed)
			get_viewport().set_input_as_handled()
			
		if pressed:
				
			if Input.is_action_just_pressed(\"ui_up\") or Input.is_action_just_pressed(\"ui_right\"):
				value += step
				get_viewport().set_input_as_handled()
				
				await(get_tree().create_timer(hold_down_delay).timeout)
				
				while Input.is_action_pressed(\"ui_up\") or Input.is_action_pressed(\"ui_right\"):
					value += step * repeat_multiplier
					await(get_tree().create_timer(repeat_delay).timeout)
				
			elif Input.is_action_just_pressed(\"ui_down\") or Input.is_action_just_pressed(\"ui_left\"):
				value -= step
				get_viewport().set_input_as_handled()
		else:
			if Input.is_action_just_pressed(\"ui_up\"):
				print(focus_neighbor_top)

func _on_focus_enter():
	get_line_edit().add_theme_stylebox_override(\"normal\", focus_stylebox)

func _on_focus_exit():
	get_line_edit().remove_theme_stylebox_override(\"normal\")
"

[node name="Video Settings" type="TabBar"]
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
script = ExtResource("1_sii8g")

[node name="VBoxContainer" type="VBoxContainer" parent="."]
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2

[node name="Label" type="Label" parent="VBoxContainer"]
layout_mode = 2
theme_type_variation = &"HeaderLarge"
text = "Video Settings"

[node name="GridContainer" type="GridContainer" parent="VBoxContainer"]
layout_mode = 2
columns = 2

[node name="General" type="Label" parent="VBoxContainer/GridContainer"]
layout_mode = 2
theme_type_variation = &"HeaderMedium"
text = "General"

[node name="HSeparator" type="HSeparator" parent="VBoxContainer/GridContainer"]
layout_mode = 2

[node name="Preset" type="Label" parent="VBoxContainer/GridContainer"]
layout_mode = 2
text = "apply preset"

[node name="HBoxContainer2" type="HBoxContainer" parent="VBoxContainer/GridContainer"]
layout_mode = 2

[node name="PerformancePreset" type="Button" parent="VBoxContainer/GridContainer/HBoxContainer2"]
unique_name_in_owner = true
layout_mode = 2
text = "Performance"

[node name="BalancedPreset" type="Button" parent="VBoxContainer/GridContainer/HBoxContainer2"]
unique_name_in_owner = true
layout_mode = 2
text = "Balanced"

[node name="QualityPreset" type="Button" parent="VBoxContainer/GridContainer/HBoxContainer2"]
unique_name_in_owner = true
layout_mode = 2
text = "Quality"

[node name="Label" type="Label" parent="VBoxContainer/GridContainer"]
layout_mode = 2
text = "Fulscreen Mode"

[node name="FullscreenMode" type="OptionButton" parent="VBoxContainer/GridContainer"]
unique_name_in_owner = true
layout_mode = 2
selected = 1
item_count = 3
popup/item_0/text = "Windowed"
popup/item_1/text = "Fullscreen"
popup/item_1/id = 1
popup/item_2/text = "exclusive Fullscreen"
popup/item_2/id = 2

[node name="Scale_Label" type="Label" parent="VBoxContainer/GridContainer"]
layout_mode = 2
text = "Rendering Scale"

[node name="HBoxContainer" type="HBoxContainer" parent="VBoxContainer/GridContainer"]
layout_mode = 2

[node name="Button" type="Button" parent="VBoxContainer/GridContainer/HBoxContainer"]
layout_mode = 2
text = "reset"

[node name="RenderScale" type="SpinBox" parent="VBoxContainer/GridContainer/HBoxContainer"]
unique_name_in_owner = true
layout_mode = 2
focus_mode = 2
min_value = 0.25
max_value = 2.0
step = 0.05
value = 1.0
prefix = "  "
suffix = "  "
custom_arrow_step = 0.25
select_all_on_focus = true
script = SubResource("GDScript_24hb5")

[node name="Label3" type="Label" parent="VBoxContainer/GridContainer"]
layout_mode = 2
text = "Super Resolution"

[node name="SuperResolution" type="OptionButton" parent="VBoxContainer/GridContainer"]
unique_name_in_owner = true
layout_mode = 2
selected = 0
item_count = 3
popup/item_0/text = "disabled"
popup/item_1/text = "FSR 1.0"
popup/item_1/id = 1
popup/item_2/text = "FSR 2.2"
popup/item_2/id = 2

[node name="EnableFps" type="CheckBox" parent="VBoxContainer/GridContainer"]
unique_name_in_owner = true
layout_mode = 2
text = "limit FPS"

[node name="MaxFps" type="SpinBox" parent="VBoxContainer/GridContainer"]
unique_name_in_owner = true
layout_mode = 2
focus_mode = 2
min_value = 24.0
max_value = 144.0
value = 60.0
prefix = "  "
suffix = "  "
script = SubResource("GDScript_24hb5")
repeat_multiplier = 5

[node name="Rendering" type="Label" parent="VBoxContainer/GridContainer"]
layout_mode = 2
theme_type_variation = &"HeaderMedium"
text = "Rendering"

[node name="HSeparator2" type="HSeparator" parent="VBoxContainer/GridContainer"]
layout_mode = 2

[node name="Label4" type="Label" parent="VBoxContainer/GridContainer"]
layout_mode = 2
text = "Lighting Quality"

[node name="LightingQuality" type="OptionButton" parent="VBoxContainer/GridContainer"]
unique_name_in_owner = true
layout_mode = 2
selected = 1
item_count = 4
popup/item_0/text = "minimum"
popup/item_1/text = "low SDGI"
popup/item_1/id = 1
popup/item_2/text = "medium SDGI and SI"
popup/item_2/id = 2
popup/item_3/text = "high SDGI and SI"
popup/item_3/id = 3

[node name="ShadowLabel" type="Label" parent="VBoxContainer/GridContainer"]
layout_mode = 2
text = "Shadow Quality"

[node name="ShadowQuality" type="OptionButton" parent="VBoxContainer/GridContainer"]
unique_name_in_owner = true
layout_mode = 2
selected = 1
item_count = 3
popup/item_0/text = "performance"
popup/item_1/text = "balanced"
popup/item_1/id = 1
popup/item_2/text = "quality"
popup/item_2/id = 2

[node name="FilterLabel" type="Label" parent="VBoxContainer/GridContainer"]
layout_mode = 2
text = "Texture Filtering"

[node name="TextureFiltering" type="OptionButton" parent="VBoxContainer/GridContainer"]
unique_name_in_owner = true
layout_mode = 2
selected = 1
item_count = 6
popup/item_0/text = "disabled"
popup/item_1/text = "1x (very fast)"
popup/item_1/id = 1
popup/item_2/text = "2x (fast)"
popup/item_2/id = 2
popup/item_3/text = "4x (average)"
popup/item_3/id = 3
popup/item_4/text = "8x (slow)"
popup/item_4/id = 4
popup/item_5/text = "16x (slowest)"
popup/item_5/id = 5

[node name="AlaisingLabel" type="Label" parent="VBoxContainer/GridContainer"]
layout_mode = 2
text = "Anti Aliasing"

[node name="AntiAlaising" type="OptionButton" parent="VBoxContainer/GridContainer"]
unique_name_in_owner = true
layout_mode = 2
selected = 1
item_count = 4
popup/item_0/text = "disabled"
popup/item_1/text = "2x MSAA"
popup/item_1/id = 1
popup/item_2/text = "4x MSAA"
popup/item_2/id = 2
popup/item_3/text = "8x MSAA"
popup/item_3/id = 3

[node name="SyncLabel" type="Label" parent="VBoxContainer/GridContainer"]
layout_mode = 2
text = "v-Sync"

[node name="vSync" type="OptionButton" parent="VBoxContainer/GridContainer"]
unique_name_in_owner = true
layout_mode = 2
selected = 1
item_count = 4
popup/item_0/text = "disabled"
popup/item_1/text = "enabled"
popup/item_1/id = 1
popup/item_2/text = "adaptive"
popup/item_2/id = 2
popup/item_3/text = "Letterbox"
popup/item_3/id = 3

[node name="ExitButton" type="Button" parent="VBoxContainer/GridContainer"]
unique_name_in_owner = true
layout_mode = 2
text = "close"

[node name="ConfirmButton" type="Button" parent="VBoxContainer/GridContainer"]
unique_name_in_owner = true
layout_mode = 2
text = "save and apply"

[node name="Popup" type="Popup" parent="."]
scaling_3d_scale = 0.6
initial_position = 2
size = Vector2i(546, 123)

[node name="VBoxContainer" type="VBoxContainer" parent="Popup"]
offset_left = 113.0
offset_right = 153.0
offset_bottom = 40.0

[node name="Label" type="Label" parent="Popup/VBoxContainer"]
layout_mode = 2
text = "Settings have been modified.
Do you really want to leave without saving?"
horizontal_alignment = 1

[node name="HBoxContainer" type="HBoxContainer" parent="Popup/VBoxContainer"]
layout_mode = 2
alignment = 1

[node name="ConfirmExit" type="Button" parent="Popup/VBoxContainer/HBoxContainer"]
unique_name_in_owner = true
layout_mode = 2
text = "leave"

[node name="ConfirmSave" type="Button" parent="Popup/VBoxContainer/HBoxContainer"]
unique_name_in_owner = true
layout_mode = 2
text = "save"

[node name="ConfirmAbort" type="Button" parent="Popup/VBoxContainer/HBoxContainer"]
unique_name_in_owner = true
layout_mode = 2
text = "abort"

[connection signal="pressed" from="VBoxContainer/GridContainer/HBoxContainer2/PerformancePreset" to="." method="_on_performance_preset_pressed"]
[connection signal="pressed" from="VBoxContainer/GridContainer/HBoxContainer2/BalancedPreset" to="." method="_on_balanced_preset_pressed"]
[connection signal="pressed" from="VBoxContainer/GridContainer/HBoxContainer2/QualityPreset" to="." method="_on_quality_preset_pressed"]
[connection signal="pressed" from="VBoxContainer/GridContainer/HBoxContainer/Button" to="VBoxContainer/GridContainer/HBoxContainer/RenderScale" method="reset"]
[connection signal="pressed" from="VBoxContainer/GridContainer/ExitButton" to="." method="_on_exit_button_pressed"]
[connection signal="pressed" from="VBoxContainer/GridContainer/ConfirmButton" to="." method="_on_confirm_button_pressed"]
