From 1ebd62bcd457959f37d24355d1c0d9fafb1e92c1 Mon Sep 17 00:00:00 2001 From: github-MaxCE <77289389+github-MaxCE@users.noreply.github.com> Date: Wed, 22 Sep 2021 21:55:24 +0100 Subject: [PATCH] added bigger and smaller operators don't know if there's a reason for them not being there but it simplified but point inside rect function so i decided to propose it to pge --- olcPixelGameEngine.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/olcPixelGameEngine.h b/olcPixelGameEngine.h index 48a9be5..76b71ec 100644 --- a/olcPixelGameEngine.h +++ b/olcPixelGameEngine.h @@ -194,7 +194,7 @@ Author ~~~~~~ - David Barr, aka javidx9, ©OneLoneCoder 2018, 2019, 2020, 2021 + David Barr, aka javidx9, ©OneLoneCoder 2018, 2019, 2020, 2021 */ #pragma endregion @@ -637,6 +637,10 @@ namespace olc v2d_generic operator - () const { return { -x, -y }; } bool operator == (const v2d_generic& rhs) const { return (this->x == rhs.x && this->y == rhs.y); } bool operator != (const v2d_generic& rhs) const { return (this->x != rhs.x || this->y != rhs.y); } + bool operator < (const v2d_generic& rhs) const { return (this->x < rhs.x && this->y < rhs.y); } + bool operator > (const v2d_generic& rhs) const { return (this->x > rhs.x && this->y > rhs.y); } + bool operator <= (const v2d_generic& rhs) const { return (this->x <= rhs.x && this->y <= rhs.y); } + bool operator >= (const v2d_generic& rhs) const { return (this->x >= rhs.x && this->y >= rhs.y); } const std::string str() const { return std::string("(") + std::to_string(this->x) + "," + std::to_string(this->y) + ")"; } friend std::ostream& operator << (std::ostream& os, const v2d_generic& rhs) { os << rhs.str(); return os; } operator v2d_generic() const { return { static_cast(this->x), static_cast(this->y) }; }