41 lines
832 B
GDScript
41 lines
832 B
GDScript
# Does this help?
|
|
tool
|
|
extends Resource
|
|
class_name SummerDayScene
|
|
|
|
signal aspect_ratio_changed(new_aspect_ratio)
|
|
|
|
|
|
export(Vector2) var aspect_ratio = Vector2(16, 9) setget _set_aspect_ratio
|
|
export(Array, Resource) var tracks
|
|
|
|
var raw_aspect_ratio setget , _get_raw_aspect_ratio
|
|
|
|
|
|
func _ready():
|
|
pass
|
|
|
|
|
|
func _set_aspect_ratio(new_aspect_ratio):
|
|
var handled_aspect_ratio = Vector2()
|
|
|
|
# Don't let the components drop below 0.01!
|
|
if new_aspect_ratio.x <= 0.01:
|
|
handled_aspect_ratio.x = 0.01
|
|
else:
|
|
handled_aspect_ratio.x = new_aspect_ratio.x
|
|
|
|
if new_aspect_ratio.y <= 0.01:
|
|
handled_aspect_ratio.y = 0.01
|
|
else:
|
|
handled_aspect_ratio.y = new_aspect_ratio.y
|
|
|
|
aspect_ratio = handled_aspect_ratio
|
|
|
|
emit_signal("aspect_ratio_changed", aspect_ratio)
|
|
|
|
|
|
func _get_raw_aspect_ratio():
|
|
return aspect_ratio.x / aspect_ratio.y
|
|
|