2018-10-06 20:39:40 -07:00
|
|
|
#pragma once
|
2016-02-13 19:39:47 -08:00
|
|
|
|
|
|
|
#include "Global.hpp"
|
2016-03-04 15:03:26 -08:00
|
|
|
#include "zeus/Math.hpp"
|
2018-11-02 01:15:50 -07:00
|
|
|
#include "CVector2f.hpp"
|
2016-02-13 19:39:47 -08:00
|
|
|
|
|
|
|
#if ZE_ATHENA_TYPES
|
2018-12-07 17:16:50 -08:00
|
|
|
|
2016-03-04 15:03:26 -08:00
|
|
|
#include <athena/IStreamReader.hpp>
|
2018-12-07 17:16:50 -08:00
|
|
|
|
2016-02-13 19:39:47 -08:00
|
|
|
#endif
|
|
|
|
|
2018-12-07 17:16:50 -08:00
|
|
|
namespace zeus {
|
2016-02-13 19:39:47 -08:00
|
|
|
|
2018-12-07 17:16:50 -08:00
|
|
|
class CVector2i {
|
2016-02-13 19:39:47 -08:00
|
|
|
public:
|
2018-12-07 17:16:50 -08:00
|
|
|
union {
|
|
|
|
struct {
|
|
|
|
int x, y;
|
2016-02-13 19:39:47 -08:00
|
|
|
};
|
2018-12-07 17:16:50 -08:00
|
|
|
int v[2];
|
|
|
|
};
|
|
|
|
|
|
|
|
CVector2i() = default;
|
|
|
|
|
|
|
|
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); }
|
|
|
|
|
2018-12-07 21:23:50 -08:00
|
|
|
CVector2i operator+(const CVector2i& val) const { return CVector2i(x + val.x, y + val.y); }
|
2018-12-07 17:16:50 -08:00
|
|
|
|
2018-12-07 21:23:50 -08:00
|
|
|
CVector2i operator-(const CVector2i& val) const { return CVector2i(x - val.x, y - val.y); }
|
2018-12-07 17:16:50 -08:00
|
|
|
|
2018-12-07 21:23:50 -08:00
|
|
|
CVector2i operator*(const CVector2i& val) const { return CVector2i(x * val.x, y * val.y); }
|
2018-12-07 17:16:50 -08:00
|
|
|
|
2018-12-07 21:23:50 -08:00
|
|
|
CVector2i operator/(const CVector2i& val) const { return CVector2i(x / val.x, y / val.y); }
|
2018-12-07 17:16:50 -08:00
|
|
|
|
2018-12-07 21:23:50 -08:00
|
|
|
bool operator==(const CVector2i& other) const { return x == other.x && y == other.y; }
|
2018-12-07 17:16:50 -08:00
|
|
|
|
2018-12-07 21:23:50 -08:00
|
|
|
bool operator!=(const CVector2i& other) const { return x != other.x || y != other.y; }
|
2018-12-07 17:16:50 -08:00
|
|
|
|
2018-12-07 21:23:50 -08:00
|
|
|
CVector2i operator*(int val) const { return CVector2i(x * val, y * val); }
|
2016-02-13 19:39:47 -08:00
|
|
|
};
|
2018-12-07 21:23:50 -08:00
|
|
|
} // namespace zeus
|