How to change window position without border

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By linwz

Is there anyway to change the window position if borderless

extends Node2D

var click_pos = Vector2.ZERO

func _ready():
	get_tree().get_root().set_transparent_background(true)

func _process(_delta):
	if Input.is_action_just_pressed("click"):
		click_pos = get_local_mouse_position()
	if Input.is_action_pressed("click"):
		OS.set_window_position(
			OS.window_position +
			get_global_mouse_position() - 
			click_pos
		)

I am going to drag the window with mouse, and I found that worked, but I don’t understand why. Can anyone tell me?

linwz | 2021-03-31 01:44

It works because the window position is changed every frame in the process function.

exuin | 2021-03-31 03:31

Thanks very much!

linwz | 2021-03-31 04:12

:bust_in_silhouette: Reply From: exuin

Try setting OS — Godot Engine (stable) documentation in English