Last active
December 19, 2020 10:47
-
-
Save andrew-wilkes/587c52c6d79f3a0d9be255b00d23f6b7 to your computer and use it in GitHub Desktop.
Godot in Windows set window size and position
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func _ready(): | |
if OS.get_name() == "Windows": | |
var screen_size = OS.get_screen_size() | |
var window_size = OS.get_window_size() | |
OS.set_window_position(Vector2((screen_size.x - window_size.x) * 0.5, 0)) | |
OS.set_window_size(Vector2(window_size.x, screen_size.y - 75)) # Allow for the tray bar |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This code is to reposition and resize the App window to fit nicely in the Windows 10 Desktop screen and not be outside of it.