CVector2f-CVector2i interop

This commit is contained in:
Jack Andersen 2018-11-01 22:15:50 -10:00
parent 88769bded0
commit 0fc3e5e9ca
1 changed files with 8 additions and 0 deletions

View File

@ -2,6 +2,7 @@
#include "Global.hpp" #include "Global.hpp"
#include "zeus/Math.hpp" #include "zeus/Math.hpp"
#include "CVector2f.hpp"
#if ZE_ATHENA_TYPES #if ZE_ATHENA_TYPES
#include <athena/IStreamReader.hpp> #include <athena/IStreamReader.hpp>
@ -22,6 +23,9 @@ public:
}; };
CVector2i() = default; CVector2i() = default;
CVector2i(int xin, int yin) : x(xin), y(yin) {} CVector2i(int xin, int yin) : x(xin), y(yin) {}
CVector2i(const CVector2f& vec) : x(int(vec.x)), y(int(vec.y)) {}
CVector2f toVec2f() const { return CVector2f(x, y); }
inline CVector2i operator+(const CVector2i& val) const inline CVector2i operator+(const CVector2i& val) const
{ {
@ -47,6 +51,10 @@ public:
{ {
return x != other.x || y != other.y; return x != other.x || y != other.y;
} }
inline CVector2i operator*(int val) const
{
return CVector2i(x * val, y * val);
}
}; };
} }