Add project files.
This commit is contained in:
@@ -0,0 +1,82 @@
|
||||
#include "iVector2.hpp"
|
||||
|
||||
/*** Custom Header File ***/
|
||||
#include "../Vector/Vector2.hpp"
|
||||
|
||||
using MathEngine::iVector2;
|
||||
using MathEngine::Vector2;
|
||||
|
||||
iVector2::iVector2( const int X /*= 0*/, const int Y /*= 0*/ )
|
||||
: x(X), y(Y)
|
||||
{}
|
||||
|
||||
iVector2::iVector2( const Vector2& copy )
|
||||
{
|
||||
x = int(copy.x);
|
||||
y = int(copy.y);
|
||||
}
|
||||
|
||||
iVector2::iVector2( const SDL_Rect& copy )
|
||||
{
|
||||
x = int(copy.x);
|
||||
y = int(copy.y);
|
||||
}
|
||||
|
||||
iVector2& iVector2::operator = ( const Vector2& copy )
|
||||
{
|
||||
x = int(copy.x);
|
||||
y = int(copy.y);
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
iVector2& iVector2::operator = ( const SDL_Rect& copy )
|
||||
{
|
||||
x = int(copy.x);
|
||||
y = int(copy.y);
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
bool iVector2::operator == ( const iVector2& other ) const
|
||||
{
|
||||
bool rtn = false;
|
||||
if (x == other.x)
|
||||
if (y == other.y)
|
||||
rtn = true;
|
||||
|
||||
return rtn;
|
||||
}
|
||||
|
||||
bool iVector2::operator == ( const SDL_Rect& other ) const
|
||||
{
|
||||
bool rtn = false;
|
||||
if (x == other.x)
|
||||
if (y == other.y)
|
||||
rtn = true;
|
||||
|
||||
return rtn;
|
||||
}
|
||||
|
||||
iVector2& iVector2::operator += ( const iVector2& other )
|
||||
{
|
||||
x += int(other.x);
|
||||
y += int(other.y);
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
iVector2& iVector2::operator += ( const SDL_Rect& other )
|
||||
{
|
||||
x += int(other.x);
|
||||
y += int(other.y);
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
iVector2 operator + (const iVector2& lhs, const iVector2& rhs)
|
||||
{
|
||||
iVector2 rs = lhs;
|
||||
rs += rhs;
|
||||
return rs;
|
||||
}
|
||||
Reference in New Issue
Block a user