RhythmGame/scripts/main.gd

22 lines
507 B
GDScript3
Raw Permalink Normal View History

2019-11-10 15:09:14 +10:30
extends Node2D
# member variables
2019-11-10 15:09:14 +10:30
var screen_height := 1080
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)
func resize():
var screen_size = $"/root".get_visible_rect().size
screen_center = screen_size*0.5
position = screen_center
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
func _ready():
$"/root".connect("size_changed", self, "resize")
resize()
2019-11-10 15:09:14 +10:30