Some arithmetic operators for CVector2i

This commit is contained in:
Jack Andersen 2016-12-30 14:50:54 -10:00
parent 17a42c15e2
commit caff50dfa5
1 changed files with 17 additions and 0 deletions

View File

@ -23,6 +23,23 @@ public:
};
CVector2i() = default;
CVector2i(int xin, int yin) : x(xin), y(yin) {}
inline CVector2i operator+(const CVector2i& val) const
{
return CVector2i(x + val.x, y + val.y);
}
inline CVector2i operator-(const CVector2i& val) const
{
return CVector2i(x - val.x, y - val.y);
}
inline CVector2i operator*(const CVector2i& val) const
{
return CVector2i(x * val.x, y * val.y);
}
inline CVector2i operator/(const CVector2i& val) const
{
return CVector2i(x / val.x, y / val.y);
}
};
}