Utility class for manipulating 2D axis aligned rectangles.
A rectangle is defined by its top-left corner and its size.
It is a very simple class defined for convenience, so its member variables (left, top, width and height) are public and can be accessed directly, just like the vector classes (Vector2 and Vector3).
To keep things simple, Rect doesn't define functions to emulate the properties that are not directly members (such as right, bottom, center, etc.), it rather only provides intersection functions.
Rect uses the usual rules for its boundaries:
- The let and top edges are included in the rectangle's area
- The right (left + width) and bottom (top + height) edges are excluded from the rectangle's area
This means that IntRect(0, 0, 1, 1) and IntRect(1, 1, 1, 1) don't intersect.
Rect is a template and may be used with any numeric type, but for simplicity the instanciations used by SFML are typedefed:
- Rect!(int) is IntRect
- Rect!(float) is FloatRect
So that you don't have to care about the template syntax.
Utility class for manipulating 2D axis aligned rectangles.
A rectangle is defined by its top-left corner and its size.
It is a very simple class defined for convenience, so its member variables (left, top, width and height) are public and can be accessed directly, just like the vector classes (Vector2 and Vector3).
To keep things simple, Rect doesn't define functions to emulate the properties that are not directly members (such as right, bottom, center, etc.), it rather only provides intersection functions.
Rect uses the usual rules for its boundaries: - The let and top edges are included in the rectangle's area - The right (left + width) and bottom (top + height) edges are excluded from the rectangle's area
This means that IntRect(0, 0, 1, 1) and IntRect(1, 1, 1, 1) don't intersect.
Rect is a template and may be used with any numeric type, but for simplicity the instanciations used by SFML are typedefed: - Rect!(int) is IntRect - Rect!(float) is FloatRect
So that you don't have to care about the template syntax.