API Reference › Rect › Rect.contains
method

Rect.contains

Rect.contains(r, px, py) -> bool

Tests whether the point (px, py) falls inside the rectangle. The left and top edges are inclusive; the right and bottom edges are exclusive, so adjacent rectangles tile without overlap. The classic use is a mouse-in-button hit test.

Example

program Demo {
  handler Step phase Update {
    if Rect.contains(button, mx, my) { press() }
  }
}
← All symbols