Point_in_rectangle - hpgDesigns/hpgdesigns-dev.io GitHub Wiki
Description
Checks if the given point is inside the given rectangle and returns the result.
Parameters
Parameter | Data Type | Description |
---|---|---|
px | double | x coordinate of the point |
py | double | y coordinate of the point |
x1 | double | x coordinate of the left side of the rectangle |
y1 | double | y coordinate of the top side of the rectangle |
x2 | double | x coordinate of the right side of the rectangle |
y2 | double | y coordinate of the bottom side of the rectangle |
Return Values
boolean: Returns whether the point lies inside the rectangle.
Example Call
// demonstrates checking if the mouse is inside the room
if (point_in_rectangle(mouse_x, mouse_y, 0, 0, room_width, room_height)) {
// mouse position lies inside the room
}
NOTOC