aboutsummaryrefslogtreecommitdiff
path: root/game/src/Game/Menu/OptionMenu/MonitorDisplaySelector.gd
diff options
context:
space:
mode:
author George L. Albany <Megacake1234@gmail.com>2023-06-04 02:17:28 +0200
committer GitHub <noreply@github.com>2023-06-04 02:17:28 +0200
commit3236f51d700674aee6ee6572109ffb3d5fa5fed2 (patch)
treeb898150a8a45e7c0d814459e7f12f39429acefeb /game/src/Game/Menu/OptionMenu/MonitorDisplaySelector.gd
parent73e29d02e48739aba5ca5db1b9575c67e795400f (diff)
parentb98166b28c47cccff731d30959b8250fb27ff408 (diff)
Merge pull request #130 from Spartan322/organize/godot-project
Diffstat (limited to 'game/src/Game/Menu/OptionMenu/MonitorDisplaySelector.gd')
-rw-r--r--game/src/Game/Menu/OptionMenu/MonitorDisplaySelector.gd18
1 files changed, 18 insertions, 0 deletions
diff --git a/game/src/Game/Menu/OptionMenu/MonitorDisplaySelector.gd b/game/src/Game/Menu/OptionMenu/MonitorDisplaySelector.gd
new file mode 100644
index 0000000..7de033a
--- /dev/null
+++ b/game/src/Game/Menu/OptionMenu/MonitorDisplaySelector.gd
@@ -0,0 +1,18 @@
+extends SettingOptionButton
+
+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
+
+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
+ else:
+ push_error("Invalid MonitorDisplaySelector index: %d" % index)
+ reset_setting(not by_user)