public final class IntRect extends Object implements Serializable
Modifier and Type | Field and Description |
---|---|
static IntRect |
EMPTY
An empty rectangle with no dimensions.
|
int |
height
The height of the rectangle.
|
int |
left
The X coordinate of the rectangle's left edge.
|
int |
top
The Y coordinate of the rectangle's top edge.
|
int |
width
The width of the rectangle.
|
Constructor and Description |
---|
IntRect(FloatRect rect)
Constructs a new rectangle by converting a floating point rectangle.
|
IntRect(int left,
int top,
int width,
int height)
Constructs a new rectangle with the specified parameters.
|
IntRect(Vector2i position,
Vector2i size)
Constructs a new rectangle with the specified parameters.
|
Modifier and Type | Method and Description |
---|---|
boolean |
contains(int x,
int y)
Tests whether a point is inside the rectangle's boundaries, including its edges.
|
boolean |
contains(Vector2i point)
Tests whether a point is inside the rectangle's boundaries, including its edges.
|
boolean |
equals(Object o) |
int |
hashCode() |
IntRect |
intersection(IntRect rect)
Tests whether this rectangle intersects with another rectangle and
calculates the rectangle of intersection.
|
String |
toString() |
public static final IntRect EMPTY
public final int left
public final int top
public final int width
public final int height
public IntRect(int left, int top, int width, int height)
left
- the X coordinate of the rectangle's left edge.top
- the Y coordinate of the rectangle's top edge.width
- the rectangle's width.height
- the rectangle's height.public IntRect(Vector2i position, Vector2i size)
position
- the position of the rectangle's top left corner.size
- the rectangle's dimension.public IntRect(FloatRect rect)
rect
- the rectangle to convert.public boolean contains(int x, int y)
x
- the X coordinate of the tested point.y
- the Y coordinate of the tested point.true
if the point lies within the rectangle's boundaries,
false
otherwise.public boolean contains(Vector2i point)
point
- the point to be tested.true
if the point lies within the rectangle's boundaries,
false
otherwise.public IntRect intersection(IntRect rect)
rect
- the rectangle to test against.null
if the rectangles do not intersect.