15 lines
351 B
GDScript3
15 lines
351 B
GDScript3
|
tool
|
||
|
extends Sprite
|
||
|
class_name TK_FittingSprite
|
||
|
|
||
|
## A Sprite that is resized to absolute pixel size, no matter the texture.
|
||
|
|
||
|
export var target_size: Vector2 setget _set_target_size
|
||
|
|
||
|
func _set_target_size(p_size: Vector2) -> void:
|
||
|
target_size = p_size
|
||
|
_update_scale()
|
||
|
|
||
|
func _update_scale() -> void:
|
||
|
scale = target_size / texture.get_size()
|