Some helper functions for managing rectangles and 2D points, in both integer and floating point versions.
More...
|
struct | SDL::Point |
| The structure that defines a point (using integers) More...
|
|
struct | SDL::FPoint |
| The structure that defines a point (using floating point values). More...
|
|
struct | SDL::Rect |
| A rectangle, with the origin at the upper left (using integers). More...
|
|
struct | SDL::FRect |
| A rectangle, with the origin at the upper left (using floats). More...
|
|
◆ IsInRect() [1/2]
constexpr bool SDL::FPoint::IsInRect |
( |
const FRect & |
r | ) |
const |
|
constexpr |
A point is considered part of a rectangle if both p
and r
are not NULL, and p
's x and y coordinates are >= to the rectangle's top left corner, and <= the rectangle's x+w and y+h. So a 1x1 rectangle considers point (0,0) and (0,1) as "inside" and (0,2) as not.
Note that this is a forced-inline function in a header, and not a public API function available in the SDL library (which is to say, the code is embedded in the calling program and the linker and dynamic loader will not be able to find this function inside SDL itself).
- Parameters
-
- Returns
- true if this is contained by
r
, false otherwise.
- Thread safety:
- It is safe to call this function from any thread.
- Since
- This function is available since SDL 3.2.0.
◆ IsInRect() [2/2]
constexpr bool SDL::Point::IsInRect |
( |
const Rect & |
r | ) |
const |
|
constexpr |
A point is considered part of a rectangle if both p
and r
are not NULL, and p
's x and y coordinates are >= to the rectangle's top left corner, and < the rectangle's x+w and y+h. So a 1x1 rectangle considers point (0,0) as "inside" and (0,1) as not.
Note that this is a forced-inline function in a header, and not a public API function available in the SDL library (which is to say, the code is embedded in the calling program and the linker and dynamic loader will not be able to find this function inside SDL itself).
- Parameters
-
- Returns
- true if this is contained by
r
, false otherwise.
- Thread safety:
- It is safe to call this function from any thread.
- Since
- This function is available since SDL 3.2.0.