mirror of
https://github.com/AxioDL/PrimeWorldEditor.git
synced 2025-12-20 10:25:40 +00:00
Initial commit of current work on Prime World Editor
This commit is contained in:
139
Common/CVector2i.cpp
Normal file
139
Common/CVector2i.cpp
Normal file
@@ -0,0 +1,139 @@
|
||||
#include "CVector2i.h"
|
||||
|
||||
CVector2i::CVector2i()
|
||||
{
|
||||
x = y = 0;
|
||||
}
|
||||
|
||||
CVector2i::CVector2i(int xy)
|
||||
{
|
||||
x = y = xy;
|
||||
}
|
||||
|
||||
CVector2i::CVector2i(int _x, int _y)
|
||||
{
|
||||
x = _x;
|
||||
y = _y;
|
||||
}
|
||||
|
||||
CVector2i CVector2i::operator+(const CVector2i& other) const
|
||||
{
|
||||
CVector2i out;
|
||||
out.x = this->x + other.x;
|
||||
out.y = this->y + other.y;
|
||||
return out;
|
||||
}
|
||||
|
||||
CVector2i CVector2i::operator-(const CVector2i& other) const
|
||||
{
|
||||
CVector2i out;
|
||||
out.x = this->x - other.x;
|
||||
out.y = this->y - other.y;
|
||||
return out;
|
||||
}
|
||||
|
||||
CVector2i CVector2i::operator*(const CVector2i& other) const
|
||||
{
|
||||
CVector2i out;
|
||||
out.x = this->x * other.x;
|
||||
out.y = this->y * other.y;
|
||||
return out;
|
||||
}
|
||||
|
||||
CVector2i CVector2i::operator/(const CVector2i& other) const
|
||||
{
|
||||
CVector2i out;
|
||||
out.x = this->x / other.x;
|
||||
out.y = this->y / other.y;
|
||||
return out;
|
||||
}
|
||||
|
||||
void CVector2i::operator+=(const CVector2i& other)
|
||||
{
|
||||
*this = *this + other;
|
||||
}
|
||||
|
||||
void CVector2i::operator-=(const CVector2i& other)
|
||||
{
|
||||
*this = *this - other;
|
||||
}
|
||||
|
||||
void CVector2i::operator*=(const CVector2i& other)
|
||||
{
|
||||
*this = *this * other;
|
||||
}
|
||||
|
||||
void CVector2i::operator/=(const CVector2i& other)
|
||||
{
|
||||
*this = *this / other;
|
||||
}
|
||||
|
||||
CVector2i CVector2i::operator+(const int other) const
|
||||
{
|
||||
CVector2i out;
|
||||
out.x = this->x + other;
|
||||
out.y = this->y + other;
|
||||
return out;
|
||||
}
|
||||
|
||||
CVector2i CVector2i::operator-(const int other) const
|
||||
{
|
||||
CVector2i out;
|
||||
out.x = this->x - other;
|
||||
out.y = this->y - other;
|
||||
return out;
|
||||
}
|
||||
|
||||
CVector2i CVector2i::operator*(const int other) const
|
||||
{
|
||||
CVector2i out;
|
||||
out.x = this->x * other;
|
||||
out.y = this->y * other;
|
||||
return out;
|
||||
}
|
||||
|
||||
CVector2i CVector2i::operator/(const int other) const
|
||||
{
|
||||
CVector2i out;
|
||||
out.x = this->x / other;
|
||||
out.y = this->y / other;
|
||||
return out;
|
||||
}
|
||||
|
||||
void CVector2i::operator+=(const int other)
|
||||
{
|
||||
*this = *this + other;
|
||||
}
|
||||
|
||||
void CVector2i::operator-=(const int other)
|
||||
{
|
||||
*this = *this - other;
|
||||
}
|
||||
|
||||
void CVector2i::operator*=(const int other)
|
||||
{
|
||||
*this = *this * other;
|
||||
}
|
||||
|
||||
void CVector2i::operator/=(const int other)
|
||||
{
|
||||
*this = *this / other;
|
||||
}
|
||||
|
||||
bool CVector2i::operator==(const CVector2i& other) const
|
||||
{
|
||||
return ((this->x == other.x) && (this->y == other.y));
|
||||
}
|
||||
|
||||
bool CVector2i::operator!=(const CVector2i& other) const
|
||||
{
|
||||
return (!(*this == other));
|
||||
}
|
||||
|
||||
int& CVector2i::operator[](int index)
|
||||
{
|
||||
return (&x)[index];
|
||||
}
|
||||
|
||||
// ************ STATIC MEMBER INTIALIZATION ************
|
||||
const CVector2i CVector2i::skZero = CVector2i(0,0);
|
||||
Reference in New Issue
Block a user