aboutsummaryrefslogtreecommitdiff
path: root/game/src/Game/Autoload/WindowOverride.gd
diff options
context:
space:
mode:
author George L. Albany <Megacake1234@gmail.com>2023-09-07 22:06:52 +0200
committer GitHub <noreply@github.com>2023-09-07 22:06:52 +0200
commit1013b3c21226f703caba954664628694aedde469 (patch)
treed32a9538df7fb451fbbcee91a11f88e5b6d3701a /game/src/Game/Autoload/WindowOverride.gd
parent06816f3b7fd8dd7a2eba7031e0646c250077c96b (diff)
parent0e408c82a010aba96915753d56f83349256f4231 (diff)
Merge pull request #153 from Spartan322/startup-hide
Diffstat (limited to 'game/src/Game/Autoload/WindowOverride.gd')
-rw-r--r--game/src/Game/Autoload/WindowOverride.gd27
1 files changed, 27 insertions, 0 deletions
diff --git a/game/src/Game/Autoload/WindowOverride.gd b/game/src/Game/Autoload/WindowOverride.gd
new file mode 100644
index 0000000..837570e
--- /dev/null
+++ b/game/src/Game/Autoload/WindowOverride.gd
@@ -0,0 +1,27 @@
+extends Node
+
+const VideoOptions = preload("res://src/Game/Menu/OptionMenu/VideoTab.tscn")
+
+func _init():
+ var window_id := DisplayServer.get_window_list()[0]
+ DisplayServer.window_set_size(Vector2(1280.0, 720.0), window_id)
+
+func _ready():
+ if ArgumentParser.get_argument(&"help"): return
+ _on_SceneTree_idle()
+ # Hack to ensure Video Options load
+ var video := VideoOptions.instantiate()
+ video.visible = false
+ add_child(video)
+ video.queue_free()
+
+func _on_SceneTree_idle():
+ var window := get_window()
+ window.set_mode(Window.MODE_FULLSCREEN)
+ await get_tree().process_frame
+ window.transparent = false
+ window.borderless = false
+ var screen_pos := DisplayServer.screen_get_position(window.current_screen)
+ var screen_size := DisplayServer.screen_get_size(window.current_screen)
+ window.position = screen_pos + (screen_size - window.size) / 2
+ ProjectSettings.set_setting.call_deferred("display/window/per_pixel_transparency/allowed", false)