RhythmGame/scripts/NoteViewport.gd

16 lines
481 B
GDScript3
Raw Permalink Normal View History

extends Viewport
2021-01-01 23:51:41 +10:30
onready var base_height = ProjectSettings.get_setting('display/window/size/height')
2020-12-23 00:02:30 +10:30
func set_render_scale(scale: Vector2):
var ws = OS.window_size
var dim = min(ws.x, ws.y)
size = Vector2(dim, dim) * scale
$Center.position = size * 0.5
2021-01-01 23:51:41 +10:30
$Center.scale = size/base_height
# Called when the node enters the scene tree for the first time.
func _ready():
Settings.connect('subsampling_changed', self, 'set_render_scale')
set_render_scale(Settings.subsampling)