stick-the-quick/vfx/UnderlayViewport.gd

22 lines
427 B
GDScript

class_name UnderlayViewport extends SubViewport
@export var apply_on_ready := false
func _ready() -> void:
get_viewport().size_changed.connect(_update_size)
_update_size()
if apply_on_ready:
apply()
func _exit_tree() -> void:
dispose()
func apply() -> void:
FX.set_underlay_viewport(self)
func dispose() -> void:
FX.clear_underlay(self)
func _update_size() -> void:
size = get_viewport().get_visible_rect().size