|
Flint Engine
Modular C++20 2D game engine powered by SDL3
|
Generic axis-aligned rectangle defined by a position and size. More...
#include <flint/math/types.h>
Collaboration diagram for Flint::Rect< T >:Public Member Functions | |
| Rect (Vec2< T > position, Vec2< T > size) | |
| Construct a Rect from explicit position and size. | |
| Rect (T x, T y, T w, T h) | |
| std::optional< Rect< T > > | findIntersection (const Rect< T > &other) const |
| Compute the intersection with another rectangle. | |
| bool | contains (const Vec2< T > &point) const |
Test whether point lies inside the rectangle (half-open interval). | |
| auto | toNative () const |
| Convert to the corresponding SDL rectangle type. | |
| std::optional< Rect > | getGlobalBounds () const |
| Return this rect as an optional, or nullopt if it has zero/negative area. | |
Static Public Member Functions | |
| static auto | fromNative (const SDL_Rect &rect) |
| Construct a Rect from an SDL_Rect. | |
Public Attributes | ||
| union { | ||
| struct { | ||
| Vec2< T > position | ||
| Vec2< T > size | ||
| } | ||
| struct { | ||
| T x | ||
| T y | ||
| T w | ||
| T h | ||
| } | ||
| }; | ||
Generic axis-aligned rectangle defined by a position and size.
| T | Element type (typically int or float). |