feat: create window with a size relative to screen size
This commit is contained in:
parent
8e0bcc51a3
commit
debccd0922
2 changed files with 3 additions and 1 deletions
|
@ -21,6 +21,7 @@ config/icon="res://assets/sprites/icon.svg"
|
|||
window/size/borderless=true
|
||||
window/size/transparent=true
|
||||
window/subwindows/embed_subwindows=false
|
||||
window/stretch/mode="viewport"
|
||||
window/per_pixel_transparency/allowed=true
|
||||
|
||||
[dotnet]
|
||||
|
|
|
@ -20,10 +20,11 @@ func move_window_to_bottom_right():
|
|||
var work_area_position: Vector2i = DisplayServer.screen_get_usable_rect(display_index).position
|
||||
var work_area_size: Vector2i = DisplayServer.screen_get_usable_rect(display_index).size
|
||||
|
||||
var window_size: Vector2i = DisplayServer.window_get_size()
|
||||
var window_size: Vector2i = Vector2i(work_area_size.y / 4 * 1.77777, work_area_size.y / 4)
|
||||
|
||||
var new_position: Vector2i = work_area_position + Vector2i(work_area_size.x - window_size.x, work_area_size.y - window_size.y)
|
||||
|
||||
DisplayServer.window_set_size(window_size)
|
||||
DisplayServer.window_set_position(new_position)
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue