//------------------------------------------------------------------------------------
// irr::core::dimension2di wrappers
//------------------------------------------------------------------------------------

extern "C" 
{

	// defaults: x,y=0.0f
	dimension2di* IrrCore_Dimension2di_new(s32 x,s32 y)
	{
		return new dimension2di(x,y);
	}
	
	dimension2di* IrrCore_Dimension2di_newFromSize(dimension2di* size)
	{
		return new dimension2di(size->Width,size->Height);
	}
	
	void IrrCore_Dimension2di_del(dimension2di* del)
	{
		if (del)
			delete del;
			
		del=0;
	}
	
	s32 IrrCore_Dimension2di_getWidth(dimension2di* size)
	{
		s32 nRetVal=0;
	
		if (size)
			nRetVal=size->Width;
	
		return nRetVal;
	}
	
	s32 IrrCore_Dimension2di_getHeight(dimension2di* size)
	{
		s32 nRetVal=0;
	
		if (size)
			nRetVal=size->Height;
	
		return nRetVal;
	}
	
	void IrrCore_Dimension2di_setWidth(dimension2di* size,s32 width)
	{
		if (size)
			size->Width=width;
	}
	
	void IrrCore_Dimension2di_setHeight(dimension2di* size,s32 height)
	{
		if (size)
			size->Height=height;
	}
	
	bool IrrCore_Dimension2di_EqEq(dimension2di* size,dimension2di* other)
	{
		return (*size==*other);
	}
	
	bool IrrCore_Dimension2di_NotEq(dimension2di* size,dimension2di* other)
	{
		return (*size!=*other);
	}
	
	void IrrCore_Dimension2di_Eq(dimension2di* size,dimension2di* other)
	{
		if (size)
			size->set(other->Width,other->Height);
	}

	// NOTE: must delete
	dimension2di* IrrCore_Dimension2di_Div(dimension2di* size,s32 scale)
	{
		if (size)
			return new dimension2di(*size / scale);
		else return 0;
	}

	// NOTE: must delete
	dimension2di* IrrCore_Dimension2di_Mult(dimension2di* size,s32 scale)
	{
		if (size)
			return new dimension2di(*size * scale);
		else return 0;
	}

	dimension2di* IrrCore_Dimension2di_DivEq(dimension2di* size,s32 scale)
	{
		if (size) {
			*size /= scale;
			return size;
		} else return 0;
	}

	dimension2di* IrrCore_Dimension2di_MultEq(dimension2di* size,s32 scale)
	{
		if (size) {
			*size *= scale;
			return size;
		} else return 0;
	}
	
	dimension2di* IrrCore_Dimension2di_set(dimension2di* size, const s32 width, const s32 height) 
	{
		if (size)
			size->set(width,height);
			
		return size;
	}

	s32 IrrCore_Dimension2di_getArea(dimension2di* size) 
	{
		if (size)
			return size->getArea();
		else return 0;
	}
	
	dimension2di* IrrCore_Dimension2di_getOptimalSize(dimension2di* size, bool requirePowerOfTwo=true, bool requireSquare=false, bool larger=true)
	{
		if (size)
			return new dimension2di(size->getOptimalSize(requirePowerOfTwo, requireSquare, larger));
		else return 0;
	}
		
	dimension2di* IrrCore_Dimension2di_getInterpolated(dimension2di* size, const dimension2di* other, f32 d)
	{
		if (size)
			return new dimension2di(size->getInterpolated(*other, d));
		else return 0;
	}	
	
	// must delete
	dimension2di* IrrCore_Dimension2di_Plus(dimension2di* size, dimension2di* other)
	{
		if (size)
			return new dimension2di(*size + *other);
		else return 0;
	}

	dimension2di* IrrCore_Dimension2di_PlusEq(dimension2di* size, dimension2di* other)
	{
		if (size) {
			*size += *other;
			return size;
		} else return 0;
	}

	dimension2di* IrrCore_Dimension2di_MinusEq(dimension2di* size, dimension2di* other)
	{
		if (size) {
			*size -= *other;
			return size;
		} else return 0;
	}
}
