2
« on: April 04, 2011, 10:26:53 am »
Right, the post has more to do with the fact that the Set* methods are missing in the DotNet wrapper for the SFML. Here is some code you can put into Sprite.cs in order to get these exposed to DotNet:
public void SetColor(byte red, byte green, byte blue, byte alpha)
{
sfSprite_SetColor(This, new Color(red, green, blue, alpha));
}
public void SetPosition(float x, float y)
{
sfSprite_SetPosition(This, x, y);
}
public void SetX(float x)
{
sfSprite_SetX(This, x);
}
public void SetY(float y)
{
sfSprite_SetY(This, y);
}
public void SetRotation(float Rotation)
{
sfSprite_SetRotation(This, Rotation);
}
public void SetCenter(float x, float y)
{
sfSprite_SetCenter(This, x, y);
}
public void SetScale(float x, float y)
{
sfSprite_SetScale(This, x, y);
}
public void SetScaleX(float x)
{
sfSprite_SetScaleX(This, x);
}
public void SetScaleY(float y)
{
sfSprite_SetScaleY(This, y);
}
public void SetBlendMode(BlendMode Mode)
{
sfSprite_SetBlendMode(This, Mode);
}
// Additional Imports
[DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity]
static extern void sfSprite_SetScaleX(IntPtr This, float x);
[DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity]
static extern void sfSprite_SetScaleY(IntPtr This, float y);
[DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity]
static extern void sfSprite_SetX(IntPtr This, float x);
[DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity]
static extern void sfSprite_SetY(IntPtr This, float y);
Every method was tested to see if it works. The only ones that I am not 100% sure of is the SetCenter and SetBlendMode because I don't have a clue what they're trying to do.