summaryrefslogtreecommitdiff
path: root/src/math.hpp
diff options
context:
space:
mode:
authorPaweł Redman <pawel.redman@gmail.com>2017-10-18 19:53:51 +0200
committerPaweł Redman <pawel.redman@gmail.com>2017-10-18 19:53:51 +0200
commit29d124b93125d7c9de762c45876f69df3acd549d (patch)
treed940787ca232a9d0587dc83856f054b9aa401e23 /src/math.hpp
parentef5273d2c2ab801b11eb435a04bff96f6e778b1c (diff)
Render bounds are now working. Start working on unit movement.
Diffstat (limited to 'src/math.hpp')
-rw-r--r--src/math.hpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/math.hpp b/src/math.hpp
index f20cc99..c07b7d0 100644
--- a/src/math.hpp
+++ b/src/math.hpp
@@ -243,6 +243,18 @@ public:
return true;
}
+ friend rect_t<T, N> operator+(const rect_t<T, N> &a, const rect_t<T, N> &b)
+ {
+ rect_t r;
+
+ r[0][0] = std::min(a[0][0], b[0][0]);
+ r[0][1] = std::min(a[0][1], b[0][1]);
+ r[1][0] = std::max(a[1][0], b[1][0]);
+ r[1][1] = std::max(a[1][1], b[1][1]);
+
+ return r;
+ }
+
friend std::ostream& operator<<(std::ostream& stream, rect_t<T, N> r)
{
stream << "(" << r[0] << ", " << r[1] << ")";