aboutsummaryrefslogtreecommitdiff
path: root/game/src/Game/Menu/OptionMenu/MonitorDisplaySelector.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/MonitorDisplaySelector.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/MonitorDisplaySelector.gd')
-rw-r--r--game/src/Game/Menu/OptionMenu/MonitorDisplaySelector.gd27
1 files changed, 19 insertions, 8 deletions
diff --git a/game/src/Game/Menu/OptionMenu/MonitorDisplaySelector.gd b/game/src/Game/Menu/OptionMenu/MonitorDisplaySelector.gd
index 7de033a..028b3df 100644
--- a/game/src/Game/Menu/OptionMenu/MonitorDisplaySelector.gd
+++ b/game/src/Game/Menu/OptionMenu/MonitorDisplaySelector.gd
@@ -1,18 +1,29 @@
-extends SettingOptionButton
+extends SettingRevertButton
func _setup_button() -> void:
clear()
for screen_index in DisplayServer.get_screen_count():
- add_item("Monitor %d" % (screen_index + 1))
- default_selected = get_viewport().get_window().current_screen
+ # Placeholder option text awaiting _update_monitor_options_text()
+ add_item(str(screen_index + 1))
+ _update_monitor_options_text()
+ default_selected = Resolution.get_current_monitor()
+
+func _notification(what : int):
+ match what:
+ NOTIFICATION_TRANSLATION_CHANGED:
+ _update_monitor_options_text()
+
+func _update_monitor_options_text() -> void:
+ for index in get_item_count():
+ set_item_text(index, tr("OPTIONS_VIDEO_MONITOR").format({ "index": Events.Localisation.tr_number(index + 1) }))
func _on_option_selected(index : int, by_user : bool) -> void:
if _valid_index(index):
- var window := get_viewport().get_window()
- var mode := window.mode
- window.mode = Window.MODE_WINDOWED
- get_viewport().get_window().set_current_screen(index)
- window.mode = mode
+ if by_user:
+ print("Start Revert Countdown!")
+ revert_dialog.show_dialog.call_deferred(self)
+ previous_index = Resolution.get_current_monitor()
+ Resolution.set_monitor(index)
else:
push_error("Invalid MonitorDisplaySelector index: %d" % index)
reset_setting(not by_user)