Closed seraph73 closed 5 years ago
Hi @pirategbl, this is related to render targets behavior, your drawing order is most likely wrong. To explain in short:
This means that the correct order you should to draw things is this:
// draw ui (on internal render target)
UserInterface.Active.Draw(spriteBatch);
// clear buffer
GraphicsDevice.Clear(Color.CornflowerBlue);
// <-- PUT YOUR GAME RENDER CODE HERE
spriteBatch.Begin();
spriteBatch.Draw(GeonBit.UI.Resources.ButtonTextures[ButtonSkin.Alternative], new Rectangle(0, 0, 500, 500), Color.White);
spriteBatch.End();
// present UI on screen
UserInterface.Active.DrawMainRenderTarget(spriteBatch);
// call base draw function
base.Draw(gameTime);
In the example above I added these lines:
spriteBatch.Begin();
spriteBatch.Draw(GeonBit.UI.Resources.ButtonTextures[ButtonSkin.Alternative], new Rectangle(0, 0, 500, 500), Color.White);
spriteBatch.End();
That will draw one of GeonBit textures as a test. You can replace that part with your own rendering code.
If the above didn't work, please let me know and reopen this issue. Thanks :)
Worked like a charm, thanks for the quick reply and continue the awesome work 👍
Let me start by saying how awesome this project is, it's exactly what i was looking for.
I'm having an issue, because I want the UI to be displayed in front of the game itself, as it should be, however when I try to do that it replaces everything else that is behind it. I took some screenshots in order to better explain it.
With the code like this, the UI draws itself before the actual game, and like this it works, not as intended, but it does.

Now, when I replace the UserInterface draw instructions below the game itself, which should make it draw after the game, this happens:
Interface shows properly, however the game itself vanishes. I was tinkering about and found that this line is actually making this happen.
So what I did was change the Color, from white to transparent, and and also change on my main game class the order of the instructions, like so
This makes the game draw itself again, but now the UI doesn't appear at all
