Skip to content

Instantly share code, notes, and snippets.

@andrew-wilkes
Last active December 19, 2020 10:47
Show Gist options
  • Save andrew-wilkes/587c52c6d79f3a0d9be255b00d23f6b7 to your computer and use it in GitHub Desktop.
Save andrew-wilkes/587c52c6d79f3a0d9be255b00d23f6b7 to your computer and use it in GitHub Desktop.
Godot in Windows set window size and position
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
@andrew-wilkes
Copy link
Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment