Skip to content

Instantly share code, notes, and snippets.

@passivestar
Last active October 1, 2024 13:37
Show Gist options
  • Save passivestar/fc4ccd5a499c19906c89bfea85d66f5f to your computer and use it in GitHub Desktop.
Save passivestar/fc4ccd5a499c19906c89bfea85d66f5f to your computer and use it in GitHub Desktop.
@tool
extends Node
@export_storage var viewport_position: Vector2
@export_storage var viewport_size: Vector2i
@export var main_screen_position_offset := Vector2(0, -18)
@export var main_screen_size_offset := Vector2i(0, -32)
func _enter_tree() -> void:
if not Engine.is_editor_hint():
return
ProjectSettings.set_setting("display/window/size/borderless", true)
ProjectSettings.set_setting("display/window/size/always_on_top", true)
ProjectSettings.save()
func _ready() -> void:
if Engine.is_editor_hint():
return
var window := get_window()
window.position = viewport_position
window.size = viewport_size
func _process(_delta: float) -> void:
if not Engine.is_editor_hint():
return
var main_screen := EditorInterface.get_editor_main_screen()
var window_position := Vector2(get_window().position)
var scale := EditorInterface.get_editor_scale()
viewport_position = window_position + main_screen.get_screen_transform().origin + main_screen_position_offset * scale
viewport_size = Vector2i(main_screen.size) + Vector2i(main_screen_size_offset * scale)
@yellowloon
Copy link

i love u big g

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