Yeah sorry about that, I was at work so didn't have access to my code. I've done a bit more digging since then, and have narrowed the problem down, but I am totally stumped. I'm using version 1.5 of SFML.
I have a wrapper around the SFML.Shape object:
public class RectangleSprite
{
public RectangleSprite(int id, int x, int y, int width, int height, Color colour)
{
rectangle = Shape.Rectangle(new Vector2(0, 0), new Vector2(width, height), colour);
rectangle.Position = new Vector2(x, y);
}
public bool OnRender(long time, long elapsedTime, RenderWindow window)
{
window.Draw(rectangle);
return true;
}
public void SetColour(Color c)
{
rectangle.Color = c;
}
private Shape rectangle;
}
I create 2 instances of this with:
test1 = new RectangleSprite(1, 0, 0, 50, 50, Color.Blue);
test2 = new RectangleSprite(1, 50, 0, 50, 50, Color.White);
which are rendered with:
public override bool OnRender(long time, long elapsedTime, RenderWindow window)
{
test1.OnRender(0, 0, window);
test2.OnRender(0, 0, window);
return true;
}
The colour of anobject changes when the mouse enters it with:
test1.SetColour(Color.Red);
test2.SetColour(Color.Red);
and when the mouse leaves again the colour is reset with:
test1.SetColour(Color.Blue);
test2.SetColour(Color.White);
The issue I have is that test2 correctly turns red when the mouse is over it as you would expect, but test1 turns black. This seems to be to do with the specific colour chosen for when the mouse is out of the rectangle. I haven't tested more than 3 or 4 of the predefined colours, but blue is the only one I've found that causes a problem so far (white, yellow and magenta work OK).
I would appreciate any thoughts people have on this, because I've reduced the problem down as much as I can, and I can't see any reason for the behaviour I'm seeing.
Thanks in advance,
Phil