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
pull/259/head
github-MaxCE 3 years ago committed by GitHub
parent 5764bbab19
commit 1ebd62bcd4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 6
      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<int32_t>() const { return { static_cast<int32_t>(this->x), static_cast<int32_t>(this->y) }; }

Loading…
Cancel
Save