Sprite.getRect

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

More...
struct Sprite
@nogc nothrow const
Rect2
getRect
()

Detailed Description

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!")

Meta