Function Sprite.getRect

Returns a Rect2 representing the Sprite's boundary in local coordinates. Can be used to detect if the Sprite was clicked. Example:

Rect2 getRect() nothrow @nogc const;

func input(event): if event is InputEventMouseButton and event.pressed and event.button_index == BUTTON_LEFT: if get_rect().has_point(to_local(event.position)): print("A click!")