Hello guys! Hope someone can help point to my error because it makes no sense to me. So the problem: Im swapping between my monogame and a form( i need the form for text inputs ), but for some reason whenever i get to the part where i close my game and open the form, 1. Alot of my forms controls are transparent 2. Through these transparent holes, you can see bits of my gamescreen, though it is actually closed. If anyone have seen this problem before please do share what is casing it!
Here is something to help, first the code i use to close the game and open the form:
case Scene.AddTip:
// input form show
inputForm = new InputForm();
inputForm.Show();
base.Initialize();
this.Exit();
And here is a screenshot of 1. How my form looks in the editor 2. How the game looks before switching to the form screen 3. The screen after its been loaded and the game closed.
Hi!
Do you call GraphicsDevice.Clear anywhere ? Where it is placed may matter.
Or the order of spritebatch calls. Or maybe layer if you use this overload of SpriteBatch.Draw
Yeah i do use it, but shouldnt the “this.Exit();” part override all my draws and just close it all before opening the form? Anyhow here is my relevant draws:
protected override void Draw(GameTime gameTime)
{
switch (currentScene)
{
case Scene.Login:
spriteBatch.Begin();
spriteBatch.Draw(Content.Load(“Title”), new Rectangle(0, 10, 800, 80), Color.White);
GraphicsDevice.Clear(Color.GreenYellow);
spriteBatch.DrawString(myFont, "Forskellige tekster her: Grunde til at blive vegetar, vegetar jokes, statistisk udvikling for relevante ting, andet?", new Vector2(200, 200), Color.White);
foreach (var btn in loginBtns)
{
btn.Draw(spriteBatch);
}
spriteBatch.End();
break;
case Scene.Overview:
spriteBatch.Begin();
spriteBatch.Draw(Content.Load<Texture2D>("Title"), new Rectangle(0, 10, 800, 80), Color.White);
GraphicsDevice.Clear(Color.GreenYellow);
myTipTable.Draw(spriteBatch);
foreach (var btn in overviewBtns)
{
btn.Draw(spriteBatch);
}
spriteBatch.End();
break;
case Scene.AddTip:
// input form show
inputForm = new InputForm();
inputForm.Show();
base.Initialize();
this.Exit();
break;
}
base.Draw(gameTime);
}