//------------------------------------------------------------------------------------
// irr::core::dimension2df wrappers
//------------------------------------------------------------------------------------

extern "C" 
{

	// defaults: x,y=0.0f
	dimension2df* IrrCore_Dimension2df_new(f32 x,f32 y)
	{
		return new dimension2df(x,y);
	}
	
	dimension2df* IrrCore_Dimension2df_newFromSize(dimension2df* size)
	{
		return new dimension2df(size->Width,size->Height);
	}
	
	void IrrCore_Dimension2df_del(dimension2df* del)
	{
		if (del)
			delete del;
			
		del=0;
	}
	
	f32 IrrCore_Dimension2df_getWidth(dimension2df* size)
	{
		f32 fRetVal=0.0f;
	
		if (size)
			fRetVal=size->Width;
	
		return fRetVal;
	}
	
	f32 IrrCore_Dimension2df_getHeight(dimension2df* size)
	{
		f32 fRetVal=0.0f;
	
		if (size)
			fRetVal=size->Height;
	
		return fRetVal;
	}
	
	void IrrCore_Dimension2df_setWidth(dimension2df* size,f32 width)
	{
		if (size)
			size->Width=width;
	}
	
	void IrrCore_Dimension2df_setHeight(dimension2df* size,f32 height)
	{
		if (size)
			size->Height=height;
	}
	
	bool IrrCore_Dimension2df_EqEq(dimension2df* size,dimension2df* other)
	{
		return (*size==*other);
	}
	
	bool IrrCore_Dimension2df_NotEq(dimension2df* size,dimension2df* other)
	{
		return (*size!=*other);
	}
	
	void IrrCore_Dimension2df_Eq(dimension2df* size,dimension2df* other)
	{
		if (size)
			size->set(other->Width,other->Height);
	}

	// NOTE: must delete
	dimension2df* IrrCore_Dimension2df_Div(dimension2df* size,f32 scale)
	{
		if (size)
			return new dimension2df(*size / scale);
		else return 0;
	}

	// NOTE: must delete
	dimension2df* IrrCore_Dimension2df_Mult(dimension2df* size,f32 scale)
	{
		if (size)
			return new dimension2df(*size * scale);
		else return 0;
	}

	dimension2df* IrrCore_Dimension2df_DivEq(dimension2df* size,f32 scale)
	{
		if (size) {
			*size /= scale;
			return size;
		} else return 0;
	}

	dimension2df* IrrCore_Dimension2df_MultEq(dimension2df* size,f32 scale)
	{
		if (size) {
			*size *= scale;
			return size;
		} else return 0;
	}

	dimension2df* IrrCore_Dimension2df_set(dimension2df* size, const f32 width, const f32 height) 
	{
		if (size)
			size->set(width,height);
			
		return size;
	}
	
	f32 IrrCore_Dimension2df_getArea(dimension2df* size) 
	{
		if (size)
			return size->getArea();
		else return 0.0;
	}

	dimension2df* IrrCore_Dimension2df_getOptimalSize(dimension2df* size, bool requirePowerOfTwo=true, bool requireSquare=false, bool larger=true)
	{
		if (size)
			return new dimension2df(size->getOptimalSize(requirePowerOfTwo, requireSquare, larger));
		else return 0;
	}
		
	dimension2df* IrrCore_Dimension2df_getInterpolated(dimension2df* size, const dimension2df* other, f32 d)
	{
		if (size)
			return new dimension2df(size->getInterpolated(*other, d));
		else return 0;
	}	
	
	// must delete
	dimension2df* IrrCore_Dimension2df_Plus(dimension2df* size, dimension2df* other)
	{
		if (size)
			return new dimension2df(*size + *other);
		else return 0;
	}

	dimension2df* IrrCore_Dimension2df_PlusEq(dimension2df* size, dimension2df* other)
	{
		if (size) {
			*size += *other;
			return size;
		} else return 0;
	}

	dimension2df* IrrCore_Dimension2df_MinusEq(dimension2df* size, dimension2df* other)
	{
		if (size) {
			*size -= *other;
			return size;
		} else return 0;
	}	
}
