//------------------------------------------------------------------------------------
// irr::core::vector2di wrappers (done)
//------------------------------------------------------------------------------------

extern "C" 
{

	// defaults: x=0, y=0
	vector2di* IrrCore_Vector2di_new(s32 x,s32 y)
	{
		vector2di* pRetVal=new vector2di(x,y);
		return pRetVal;
	}
	
	vector2di* IrrCore_Vector2di_newFromVect(vector2di* other)
	{
		vector2di* pRetVal=new vector2di(*other);
		return pRetVal;
	}

	vector2di* IrrCore_Vector2di_newFromVal(s32 n)
	{
		return new vector2di(n);
	}
	
	void IrrCore_Vector2di_del(vector2di* delVect)
	{
		if (delVect>0)
			delete delVect;
		delVect=0;
	}
	
	vector2di* IrrCore_Vector2di_set(vector2di* vect,s32 x,s32 y)
	{
		if (vect>0)
			return &(vect->set(x,y));
		else return 0;
	}
	
	vector2di* IrrCore_Vector2di_setFromVect(vector2di* vect,vector2di* other)
	{
		if (vect>0)
			return &(vect->set(*other));
		else return 0;
	}
	
	s32 IrrCore_Vector2di_getX(vector2di* vect)
	{
		s32 nRetVal=0;
	
		if (vect>0)
			nRetVal=vect->X;
	
		return nRetVal;
	}
	
	s32 IrrCore_Vector2di_getY(vector2di* vect)
	{
		s32 nRetVal=0;
	
		if (vect>0)
			nRetVal=vect->Y;
	
		return nRetVal;
	}
	
	void IrrCore_Vector2di_setX(vector2di* vect,s32 x)
	{
		if (vect>0)
			vect->X=x;
	}
	
	void IrrCore_Vector2di_setY(vector2di* vect,s32 y)
	{
		if (vect>0)
			vect->Y=y;
	}
	
	s32 IrrCore_Vector2di_getLength(vector2di* vect)
	{
		s32 fRetVal=0;
	
		if (vect>0)
			fRetVal=vect->getLength();
	
		return fRetVal;
	}
	
	s32 IrrCore_Vector2di_dotProduct(vector2di* vect,vector2di* other)
	{
		s32 nRetVal=0;
	
		if (vect>0)
			nRetVal=vect->dotProduct(*other);
	
		return nRetVal;
	}
	
	s32 IrrCore_Vector2di_getDistanceFrom(vector2di* vect,vector2di* other)
	{
		s32 fRetVal=0;
	
		if (vect>0)
			fRetVal=vect->getDistanceFrom(*other);
	
		return fRetVal;
	}
	
	vector2di* IrrCore_Vector2di_rotateBy(vector2di* vect,f64 degrees,vector2di* center = 0)
	{
		if (vect>0)
			return &(vect->rotateBy(degrees,(center ? *center : vector2di())));
		else return 0;
	}
	
	// do not delete
	vector2di* IrrCore_Vector2di_normalize(vector2di* vect)
	{
		if (vect>0)
			return &vect->normalize();	
		else return 0;
	}

	f64 IrrCore_Vector2di_getAngleTrig(vector2di* vect)
	{
		if (vect)
			return vect->getAngleTrig();
		else return 0.0;
	}
	
	f64 IrrCore_Vector2di_getAngle(vector2di* vect)
	{
		f64 fRetVal=0.0;
	
		if (vect>0)
			fRetVal=vect->getAngle();
	
		return fRetVal;
	}
	
	f64 IrrCore_Vector2di_getAngleWith(vector2di* vect,vector2di* other)
	{
		f64 fRetVal=0.0;
	
		if (vect>0)
			fRetVal=vect->getAngleWith(*other);
	
		return fRetVal;
	}
	
	vector2di* IrrCore_Vector2di_setEq(vector2di* vect,vector2di* other)
	{
		if (vect>0) {
			*vect=*other;
			return vect;
		} else return 0;
	}
	
	bool IrrCore_Vector2di_EqEq(vector2di* vect,vector2di* other)
	{
		bool lRetVal=false;
	
		if (vect>0)
			lRetVal=(*vect==*other);
	
		return lRetVal;
	}
	
	bool IrrCore_Vector2di_NotEq(vector2di* vect,vector2di* other)
	{
		bool lRetVal=false;
	
		if (vect>0)
			lRetVal=(*vect!=*other);
	
		return lRetVal;
	}
	
	vector2di* IrrCore_Vector2di_PlusVect(vector2di* vect,vector2di* other)
	{
		vector2di* pRetVal=new vector2di((*vect+*other));
		return pRetVal;
	}
	
	vector2di* IrrCore_Vector2di_PlusEqVect(vector2di* vect,vector2di* other)
	{
		if (vect>0) {
			*vect+=*other;
			return vect;
		} else return 0;
	}

	vector2di* IrrCore_Vector2di_Plus(vector2di* vect,s32 val)
	{
		vector2di* pRetVal=new vector2di((*vect + val));
		return pRetVal;
	}
	
	vector2di* IrrCore_Vector2di_PlusEq(vector2di* vect,s32 val)
	{
		if (vect>0) {
			*vect += val;
			return vect;
		} else return 0;
	}
	
	vector2di* IrrCore_Vector2di_MinusVect(vector2di* vect,vector2di* other)
	{
		vector2di* pRetVal=new vector2di((*vect-*other));
		return pRetVal;
	}
	
	vector2di* IrrCore_Vector2di_MinusEqVect(vector2di* vect,vector2di* other)
	{
		if (vect>0) {
			*vect-=*other;
			return vect;
		} else return 0;
	}
	
	vector2di* IrrCore_Vector2di_Minus(vector2di* vect,s32 val)
	{
		vector2di* pRetVal=new vector2di((*vect - val));
		return pRetVal;
	}
	
	vector2di* IrrCore_Vector2di_MinusEq(vector2di* vect,s32 val)
	{
		if (vect>0) {
			*vect -= val;
			return vect;
		} else return 0;
	}
		
	vector2di* IrrCore_Vector2di_MultVect(vector2di* vect,vector2di* other)
	{
		vector2di* pRetVal=new vector2di((*vect * *other));
		return pRetVal;
	}
	
	vector2di* IrrCore_Vector2di_Mult(vector2di* vect,s32 v)
	{
		vector2di* pRetVal=new vector2di((*vect*v));
		return pRetVal;
	}
	
	vector2di* IrrCore_Vector2di_MultEqVect(vector2di* vect,vector2di* other)
	{
		if (vect>0) {
			*vect*=*other;
			return vect;
		} else return 0;
	}
	
	vector2di* IrrCore_Vector2di_MultEq(vector2di* vect,s32 v)
	{
		if (vect>0) {
			*vect*=v;
			return vect;
		} else return 0;
	}
	
	vector2di* IrrCore_Vector2di_DivVect(vector2di* vect,vector2di* other)
	{
		vector2di* pRetVal=new vector2di((*vect / *other));
		return pRetVal;
	}
	
	vector2di* IrrCore_Vector2di_Div(vector2di* vect,s32 v)
	{
		vector2di* pRetVal=new vector2di((*vect / v));
		return pRetVal;
	}
	
	vector2di* IrrCore_Vector2di_DivEqVect(vector2di* vect,vector2di* other)
	{
		if (vect>0) {
			*vect/=*other;
			return vect;
		} else return 0;
	}
	
	vector2di* IrrCore_Vector2di_DivEq(vector2di* vect,s32 v)
	{
		if (vect>0) {
			*vect/=v;
			return vect;
		} else return 0;
	}
	
	vector2di* IrrCore_Vector2di_interpolate(vector2di* vect,vector2di* a, vector2di* b, f32 t)
	{
		if (vect)
			&(vect->interpolate(*a,*b,t));
		return 0;
	}
	
	bool IrrCore_Vector2di_LessEq(vector2di* vect,const vector2di& other)	
	{
		if (vect)
			return *vect <= other;
		else return false;
	}
	
	bool IrrCore_Vector2di_GreatEq(vector2di* vect,const vector2di& other)
	{
		if (vect)
			return *vect >= other;
		else return false;
	}

	bool IrrCore_Vector2di_Less(vector2di* vect,const vector2di& other)
	{
		if (vect)
			return *vect < other;
		else return false;
	}

	bool IrrCore_Vector2di_Great(vector2di* vect,const vector2di& other)
	{
		if (vect)
			return *vect > other;
		else return false;
	}

	bool IrrCore_Vector2di_equals(vector2di* vect,const vector2di& other)
	{
		if (vect)
			return vect->equals(other);
		else return false;
	}
	
	s32 IrrCore_Vector2di_getLengthSQ(vector2di* vect)
	{
		if (vect)
			return vect->getLengthSQ();
		else return 0.0;
	}
	
	s32 IrrCore_Vector2di_getDistanceFromSQ(vector2di* vect,const vector2di& other)
	{
		if (vect)
			return vect->getDistanceFromSQ(other);
		else return 0.0;
	}
	
	bool IrrCore_Vector2di_isBetweenPoints(vector2di* vect,const vector2di& begin, const vector2di& end)
	{
		if (vect)
			return vect->isBetweenPoints(begin,end);
		else return false;
	}
	
	vector2di* IrrCore_Vector2di_getInterpolated_quadratic(vector2di* vect,const vector2di& v2, const vector2di& v3, f64 d)
	{
		if (vect)
			return new vector2di(vect->getInterpolated_quadratic(v2,v3,d));
		else return 0;
	}	

	vector2di* IrrCore_Vector2di_getInterpolated(vector2di* vect, const vector2di* other, f64 d)
	{
		if (vect)
			return new vector2di(vect->getInterpolated(*other, d));
		else return 0;
	}
	
}