7 #ifndef NAZARA_RECT_HPP 8 #define NAZARA_RECT_HPP 10 #include <Nazara/Core/String.hpp> 11 #include <Nazara/Math/Enums.hpp> 12 #include <Nazara/Math/Vector2.hpp> 16 struct SerializationContext;
23 Rect(T Width, T Height);
24 Rect(T X, T Y, T Width, T Height);
25 Rect(
const T rect[4]);
28 template<
typename U>
explicit Rect(
const Rect<U>& rect);
56 Rect&
Set(T X, T Y, T Width, T Height);
74 Rect& operator=(
const Rect& other) =
default;
87 T x, y, width, height;
102 std::ostream& operator<<(std::ostream& out, const Nz::Rect<T>& rect);
104 #include <Nazara/Math/Rect.inl> 106 #endif // NAZARA_RECT_HPP bool Contains(T X, T Y) const
Tests whether the rectangle contains the provided point inclusive of the edge of the rectangle...
Definition: Rect.inl:118
static Rect Lerp(const Rect &from, const Rect &to, T interpolation)
Interpolates the rectangle to other one with a factor of interpolation.
Definition: Rect.inl:768
Rect & Set(T Width, T Height)
Sets the components of the rectangle with width and height.
Definition: Rect.inl:429
TODO: Inherit SoundEmitter from Node.
Definition: Algorithm.hpp:12
Rect & operator*=(T scalar)
Multiplies the lengths of this rectangle with the scalar.
Definition: Rect.inl:670
Vector2< T > GetMinimum() const
Gets a Vector2 for the minimum point.
Definition: Rect.inl:293
bool Unserialize(SerializationContext &context, bool *value)
Unserializes a boolean.
Definition: Algorithm.inl:279
Vector2< T > GetMaximum() const
Gets a Vector2 for the maximum point.
Definition: Rect.inl:280
Vector2< T > GetPosition() const
Gets a Vector2 for the position.
Definition: Rect.inl:329
Core class that represents a string.
Definition: String.hpp:22
Math class that represents an axis-aligned rectangle in two dimensions.
Definition: Rect.hpp:19
bool operator!=(const Rect &rect) const
Compares the rectangle to other one.
Definition: Rect.inl:748
Vector2< T > GetLengths() const
Gets a Vector2 for the lengths.
Definition: Rect.inl:267
Vector2< T > GetPositiveVertex(const Vector2< T > &normal) const
Computes the positive vertex of one direction.
Definition: Rect.inl:344
bool IsValid() const
Checks whether this rectangle is valid.
Definition: Rect.inl:395
Rect & ExtendTo(T X, T Y)
Extends the rectangle to contain the point in the boundary.
Definition: Rect.inl:166
bool Intersect(const Rect &rect, Rect *intersection=nullptr) const
Checks whether or not this rectangle intersects another one.
Definition: Rect.inl:366
Structure containing a serialization/unserialization context states.
Definition: SerializationContext.hpp:18
Rect & operator/=(T scalar)
Divides the lengths of this rectangle with the scalar.
Definition: Rect.inl:702
Rect operator*(T scalar) const
Multiplies the lengths with the scalar.
Definition: Rect.inl:618
Rect & MakeZero()
Makes the rectangle position (0, 0) and lengths (0, 0)
Definition: Rect.inl:408
Rect operator/(T scalar) const
Divides the lengths with the scalar.
Definition: Rect.inl:644
bool Serialize(SerializationContext &context, bool value)
Serializes a boolean.
Definition: Algorithm.inl:214
String ToString() const
Gives a string representation.
Definition: Rect.inl:553
Vector2< T > GetCenter() const
Gets a Vector2 for the center.
Definition: Rect.inl:225
T & operator[](std::size_t i)
Returns the ith element of the rectangle.
Definition: Rect.inl:586
Vector2< T > GetCorner(RectCorner corner) const
Gets the Vector2 for the corner.
Definition: Rect.inl:240
bool operator==(const Rect &rect) const
Compares the rectangle to other one.
Definition: Rect.inl:734
Vector2< T > GetNegativeVertex(const Vector2< T > &normal) const
Computes the negative vertex of one direction.
Definition: Rect.inl:308
static Rect Zero()
Shorthand for the rectangle (0, 0, 0, 0)
Definition: Rect.inl:795
Rect & Translate(const Vector2< T > &translation)
Translates the rectangle.
Definition: Rect.inl:568
Math class that represents an element of the two dimensional vector space.
Definition: Matrix4.hpp:21