Browse Source

Operators for Point: +, -, +=, -= (#1739)

pull/1756/head
Vladimir Olteanu 5 years ago committed by GitHub
parent
commit
ebd57e4bc6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 26
      Source/engine.h

26
Source/engine.h

@ -60,6 +60,32 @@ enum direction : uint8_t {
struct Point {
int x;
int y;
Point &operator +=(const Point &other)
{
x += other.x;
y += other.y;
return *this;
}
Point &operator -=(const Point &other)
{
x -= other.x;
y -= other.y;
return *this;
}
friend Point operator +(Point a, const Point &b)
{
a += b;
return a;
}
friend Point operator -(Point a, const Point &b)
{
a -= b;
return a;
}
};
struct ActorPosition {

Loading…
Cancel
Save