SPARK  0.1.0
A general purpose game engine written in C++.
Loading...
Searching...
No Matches
Rectangle.h
1#pragma once
2
3#include "spark/math/Vector2.h"
4
5namespace spark::math
6{
13 template <typename T>
15 {
16 public:
18 constexpr Rectangle() = default;
19
25 explicit Rectangle(const Vector2<T>& position, const Vector2<T>& extent);
26
34 explicit Rectangle(T x, T y, T width, T height);
35
41 constexpr bool operator==(const Rectangle& other) const noexcept;
42
48 constexpr bool operator!=(const Rectangle& other) const noexcept;
49
55 template <typename To>
56 constexpr Rectangle<To> castTo() const;
57
58 public:
59 spark::math::Vector2<T> position = {};
60 spark::math::Vector2<T> extent = {};
61 };
62}
63
64#include "spark/math/impl/Rectangle.h"
Represents a rectangle in 2D space.
Definition Rectangle.h:15
constexpr Rectangle()=default
\brif Initializes a Rectangle with position and extent set to {0, 0}.
constexpr bool operator!=(const Rectangle &other) const noexcept
Compares two Rectangle for inequality.
Definition Rectangle.h:21
constexpr Rectangle< To > castTo() const
Casts the rectangle to a rectangle with a different component type.
Definition Rectangle.h:28
constexpr bool operator==(const Rectangle &other) const noexcept
Compares two Rectangle for equality.
Definition Rectangle.h:15
A vector with two components.
Definition Vector2.h:13