2019-11-10 15:09:14 +10:30
|
|
|
extends Node2D
|
|
|
|
|
2019-11-13 00:48:06 +10:30
|
|
|
# member variables
|
2019-11-10 15:09:14 +10:30
|
|
|
var screen_height := 1080
|
2019-12-17 15:05:27 +10:30
|
|
|
var x_margin := 0.0
|
|
|
|
var y_margin := 0.0
|
2019-11-10 15:09:14 +10:30
|
|
|
var screen_center := Vector2(1920/2, screen_height/2)
|
|
|
|
|
2019-12-17 15:05:27 +10:30
|
|
|
func resize():
|
|
|
|
var screen_size = $"/root".get_visible_rect().size
|
|
|
|
screen_center = screen_size*0.5
|
|
|
|
position = screen_center
|
2019-12-21 20:42:19 +10:30
|
|
|
|
2019-12-17 15:05:27 +10:30
|
|
|
screen_height = screen_size.y
|
|
|
|
x_margin = max((screen_size.x - screen_size.y)/2.0, 0.0)
|
|
|
|
y_margin = max((screen_size.y - screen_size.x)/2.0, 0.0)
|
2019-11-10 15:09:14 +10:30
|
|
|
|
2019-12-17 15:05:27 +10:30
|
|
|
func _ready():
|
|
|
|
$"/root".connect("size_changed", self, "resize")
|
|
|
|
resize()
|
2019-11-10 15:09:14 +10:30
|
|
|
|