From 29d124b93125d7c9de762c45876f69df3acd549d Mon Sep 17 00:00:00 2001 From: Paweł Redman Date: Wed, 18 Oct 2017 19:53:51 +0200 Subject: Render bounds are now working. Start working on unit movement. --- src/math.hpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src/math.hpp') 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 operator+(const rect_t &a, const rect_t &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 r) { stream << "(" << r[0] << ", " << r[1] << ")"; -- cgit