extends Control
export var scale = 2 setget set_scale
export var upThreshold = 1.0/Engine.iterations_per_second
export var downThreshold = 1.0/30.0
export var delay = 1.0
func _ready():
set_scale(scale)
$"/root/Music/BGM".play()
func _process(delta):
# Give the system time to adjust
if delay > 0:
delay -= delta
return
if delta > downThreshold:
print("GPU is taking too much (", delta, "s < ", downThreshold, "s), adjusting shader scale")
set_scale(scale+1)
elif delta < upThreshold and scale > 2:
print("GPU is taking it easy (", delta, "s < ", upThreshold, "s), adjusting shader scale")
set_scale(scale-1)
func set_scale(val):
scale = val
$Viewport.size = rect_size / scale
$Background.update()
func _on_resized():
func _host_pressed():
$"/root/Music/BGM".stop()
$"/root/Multiplayer".host()
func _join_pressed():
pass
func _server_addr_changed(new_text: String):
$CenterContainer/PanelContainer/HBoxContainer/JoinButton.disabled = new_text.length() < 1