SPARK
0.1.0
A general purpose game engine written in C++.
|
Represents a rectangle in 2D space. More...
#include <Rectangle.h>
Public Member Functions | |
constexpr | Rectangle ()=default |
\brif Initializes a Rectangle with position and extent set to {0, 0}. | |
Rectangle (const Vector2< T > &position, const Vector2< T > &extent) | |
Initializes a Rectangle with the given position and extent. | |
Rectangle (T x, T y, T width, T height) | |
Initializes a Rectangle with the given position and extent. | |
constexpr bool | operator== (const Rectangle &other) const noexcept |
Compares two Rectangle for equality. | |
constexpr bool | operator!= (const Rectangle &other) const noexcept |
Compares two Rectangle for inequality. | |
template<typename To > | |
constexpr Rectangle< To > | castTo () const |
Casts the rectangle to a rectangle with a different component type. | |
Public Attributes | |
spark::math::Vector2< T > | position = {} |
spark::math::Vector2< T > | extent = {} |
Represents a rectangle in 2D space.
T | The type of the rectangle's components. |
A rectangle is defined by a position (top left) and an extent (width and height).
|
explicit |
Initializes a Rectangle with the given position and extent.
position | The position of the rectangle (top left corner coordinates). |
extent | The extent of the rectangle (width and height). |
|
explicit |
Initializes a Rectangle with the given position and extent.
x | The x coordinate of the rectangle's top left corner. |
y | The y coordinate of the rectangle's top left corner. |
width | The width of the rectangle. |
height | The height of the rectangle. |
|
constexpr |
Casts the rectangle to a rectangle with a different component type.
To | The type of the new rectangle's components. |
To
.
|
constexprnoexcept |
|
constexprnoexcept |