mirror of https://github.com/axmolengine/axmol.git
Merge pull request #8928 from Svenito/vec_op
Add greater than operator to Vec2
This commit is contained in:
commit
34c2587f7c
|
@ -418,6 +418,15 @@ public:
|
|||
* @return True if this vector is less than the given vector, false otherwise.
|
||||
*/
|
||||
inline bool operator<(const Vec2& v) const;
|
||||
|
||||
/**
|
||||
* Determines if this vector is greater than the given vector.
|
||||
*
|
||||
* @param v The vector to compare against.
|
||||
*
|
||||
* @return True if this vector is greater than the given vector, false otherwise.
|
||||
*/
|
||||
inline bool operator>(const Vec2& v) const;
|
||||
|
||||
/**
|
||||
* Determines if this vector is equal to the given vector.
|
||||
|
|
|
@ -82,6 +82,15 @@ inline bool Vec2::operator<(const Vec2& v) const
|
|||
return x < v.x;
|
||||
}
|
||||
|
||||
inline bool Vec2::operator>(const Vec2& v) const
|
||||
{
|
||||
if (x == v.x)
|
||||
{
|
||||
return y > v.y;
|
||||
}
|
||||
return x > v.x;
|
||||
}
|
||||
|
||||
inline bool Vec2::operator==(const Vec2& v) const
|
||||
{
|
||||
return x==v.x && y==v.y;
|
||||
|
|
Loading…
Reference in New Issue