Files
SDLPongCPP/.svn/pristine/ed/edfb74828e22350bcf1b9103e2a808850f4b598b.svn-base
T
2018-06-25 21:48:45 -04:00

82 lines
1.2 KiB
Plaintext

#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;
}