Browse Source

feat: add a button to help setting the window size

master
Dominique Merle 2 years ago
parent
commit
d2de140a44
  1. 2
      gui/MainMenu.tscn
  2. 21
      gui/forms/SettingsForm.gd
  3. 7
      gui/forms/SettingsForm.tscn

2
gui/MainMenu.tscn

@ -3,7 +3,7 @@
[ext_resource path="res://gui/MainMenu.gd" type="Script" id=1]
[ext_resource path="res://gui/widgets/Background.tscn" type="PackedScene" id=2]
[node name="Application" type="Control"]
[node name="MainMenu" type="Control"]
anchor_right = 1.0
anchor_bottom = 1.0
script = ExtResource( 1 )

21
gui/forms/SettingsForm.gd

@ -17,6 +17,11 @@ func _ready():
"provider_MajorityJudgmentDemoProvider_enabled",
false
)
update_window_size_inputs()
initializing = false
func update_window_size_inputs():
WindowSizeWidthLineEdit.text = str(Config.get_parameter(
"video.window.width",
OS.window_size.x
@ -25,7 +30,6 @@ func _ready():
"video.window.height",
OS.window_size.y
))
initializing = false
func _on_DoneButton_pressed():
@ -60,6 +64,7 @@ func _on_WindowSizeWidthLineEdit_focus_exited():
"video.window.width",
width
)
OS.window_size = Vector2(width, OS.window_size.y)
func _on_WindowSizeHeightLineEdit_focus_exited():
@ -70,3 +75,17 @@ func _on_WindowSizeHeightLineEdit_focus_exited():
"video.window.height",
height
)
OS.window_size = Vector2(OS.window_size.x, height)
func _on_WindowSizeDetectionButton_pressed():
var ws = OS.window_size
Config.set_parameter(
"video.window.width",
ws.x
)
Config.set_parameter(
"video.window.height",
ws.y
)
update_window_size_inputs()

7
gui/forms/SettingsForm.tscn

@ -170,6 +170,12 @@ margin_right = 257.0
margin_bottom = 24.0
align = 1
[node name="WindowSizeDetectionButton" type="Button" parent="CenterContainer/VBoxContainer/TabContainer/General/VBoxContainer/WindowSizeContainer"]
margin_left = 261.0
margin_right = 316.0
margin_bottom = 24.0
text = "Detect"
[node name="PanelContainer" type="PanelContainer" parent="CenterContainer/VBoxContainer"]
visible = false
margin_top = 40.0
@ -201,4 +207,5 @@ visible = false
[connection signal="pressed" from="CenterContainer/VBoxContainer/TabContainer/Providers/VBoxContainer/TwitchContainer/TwitchConfigureButton" to="." method="_on_TwitchConfigureButton_pressed"]
[connection signal="focus_exited" from="CenterContainer/VBoxContainer/TabContainer/General/VBoxContainer/WindowSizeContainer/WindowSizeWidthLineEdit" to="." method="_on_WindowSizeWidthLineEdit_focus_exited"]
[connection signal="focus_exited" from="CenterContainer/VBoxContainer/TabContainer/General/VBoxContainer/WindowSizeContainer/WindowSizeHeightLineEdit" to="." method="_on_WindowSizeHeightLineEdit_focus_exited"]
[connection signal="pressed" from="CenterContainer/VBoxContainer/TabContainer/General/VBoxContainer/WindowSizeContainer/WindowSizeDetectionButton" to="." method="_on_WindowSizeDetectionButton_pressed"]
[connection signal="pressed" from="CenterContainer/VBoxContainer/HBoxContainer/DoneButton" to="." method="_on_DoneButton_pressed"]
Loading…
Cancel
Save