Just want to get some clarity on the draw order of Shapes and Sprites, and what the recommended method of controlling draw order is.
I was a bit surprised to find that Shapes seem to be drawn in the reverse order they were added. Furthermore, Shapes seem to always be drawn over Sprites in the same Scene.
The following draws a completely black screen, due to the background being rendered last.
Shape background = new Shape(mBackgroundColor, Engine.Width, Engine.Height) { Name = "Background" };
Shape testShape = new Shape(new Color(1f, 1f, 1f, 1f), 256, 256) { X = Engine.Width / 2, Y = Engine.Height / 2 };
Sprite testSprite = Res.Assets.logo_arcane_computer.CreateSprite();
testSprite.X = Engine.Width / 2f;
testSprite.Y = Engine.Height / 2f;
testSprite.PivotX = testSprite.Data.Rect.width * 0.5f;
testSprite.PivotY = testSprite.Data.Rect.height * 0.5f;
At first I thought would just need to change the order to get the Sprite to draw over the two Shapes, but alas, the following shows a black screen with a white square; the Sprite is hidden beneath the two Shapes:
Sprite testSprite = Res.Assets.logo_arcane_computer.CreateSprite();
testSprite.X = Engine.Width / 2f;
testSprite.Y = Engine.Height / 2f;
testSprite.PivotX = testSprite.Data.Rect.width * 0.5f;
testSprite.PivotY = testSprite.Data.Rect.height * 0.5f;
Shape testShape = new Shape(new Color(1f, 1f, 1f, 1f), 256, 256) { X = Engine.Width / 2, Y = Engine.Height / 2 };
Shape background = new Shape(mBackgroundColor, Engine.Width, Engine.Height) { Name = "Background" };
I couldn’t find any way to control the “depth” of objects in a Scene, but I do see that Scenes have a depth value. Is there a way to control the depth of rendered entities that I’m missing, or is the intent to use Scenes exclusively to control render depth (that seems like it might be overkill if I want to have fine control over depth per entity)?
Somewhat related; I started down this path because I couldn’t find a way to set the Clear Color of the renderer, so consider that a feature request if it doesn’t exist already!