Files
fishy-fingers/assets/scripts/background_scaler.gd
2026-02-28 13:55:12 +01:00

11 lines
291 B
GDScript

extends Sprite2D
func scale_to_window():
var window_size = get_viewport_rect().size
var texture_size = texture.get_size()
scale = window_size / texture_size
position = window_size / 2 # Center it (origin is top-left by default)
func _process(delta: float) -> void:
scale_to_window()