aboutsummaryrefslogtreecommitdiff
path: root/game/src/Game/Menu/OptionMenu/ScreenModeSelector.gd
diff options
context:
space:
mode:
author Hop311 <Hop3114@gmail.com>2023-06-24 00:55:45 +0200
committer GitHub <noreply@github.com>2023-06-24 00:55:45 +0200
commit432000a3ab73980fc6421b3587de4b97af30d3ad (patch)
tree4b80d98261252f25011e34b22a8d49767525559f /game/src/Game/Menu/OptionMenu/ScreenModeSelector.gd
parent40cf0fa95e325f3bf875e42c11254da23192f506 (diff)
parent206cafc8bba310e4d4f35f4898ef3ac289abe81a (diff)
Merge pull request #131 from OpenVicProject/ui-cleanup
Localisation and UI focus cleanup
Diffstat (limited to 'game/src/Game/Menu/OptionMenu/ScreenModeSelector.gd')
-rw-r--r--game/src/Game/Menu/OptionMenu/ScreenModeSelector.gd15
1 files changed, 5 insertions, 10 deletions
diff --git a/game/src/Game/Menu/OptionMenu/ScreenModeSelector.gd b/game/src/Game/Menu/OptionMenu/ScreenModeSelector.gd
index af95901..a1a26a0 100644
--- a/game/src/Game/Menu/OptionMenu/ScreenModeSelector.gd
+++ b/game/src/Game/Menu/OptionMenu/ScreenModeSelector.gd
@@ -5,7 +5,7 @@ extends SettingRevertButton
enum ScreenMode { Unknown = -1, Fullscreen, Borderless, Windowed }
-func get_screen_mode_from_window_mode(window_mode : int) -> ScreenMode:
+func get_screen_mode_from_window_mode(window_mode : Window.Mode) -> ScreenMode:
match window_mode:
Window.MODE_EXCLUSIVE_FULLSCREEN:
return ScreenMode.Fullscreen
@@ -16,7 +16,7 @@ func get_screen_mode_from_window_mode(window_mode : int) -> ScreenMode:
_:
return ScreenMode.Unknown
-func get_window_mode_from_screen_mode(screen_mode : int) -> Window.Mode:
+func get_window_mode_from_screen_mode(screen_mode : ScreenMode) -> Window.Mode:
match screen_mode:
ScreenMode.Fullscreen:
return Window.MODE_EXCLUSIVE_FULLSCREEN
@@ -28,7 +28,7 @@ func get_window_mode_from_screen_mode(screen_mode : int) -> Window.Mode:
return Window.MODE_EXCLUSIVE_FULLSCREEN
func _setup_button():
- default_selected = get_screen_mode_from_window_mode(get_viewport().get_window().mode)
+ default_selected = get_screen_mode_from_window_mode(Resolution.get_current_window_mode())
selected = default_selected
func _on_option_selected(index : int, by_user : bool) -> void:
@@ -36,13 +36,8 @@ func _on_option_selected(index : int, by_user : bool) -> void:
if by_user:
print("Start Revert Countdown!")
revert_dialog.show_dialog.call_deferred(self)
- previous_index = get_screen_mode_from_window_mode(get_viewport().get_window().mode)
-
- var current_resolution := Resolution.get_current_resolution()
- var window_mode := get_window_mode_from_screen_mode(index)
- Resolution.window_mode_changed.emit(window_mode)
- get_viewport().get_window().mode = window_mode
- Resolution.set_resolution(current_resolution)
+ previous_index = get_screen_mode_from_window_mode(Resolution.get_current_window_mode())
+ Resolution.set_window_mode(get_window_mode_from_screen_mode(index))
else:
push_error("Invalid ScreenModeSelector index: %d" % index)
reset_setting(not by_user)