Reputation: 90
I am making a game that has a main home screen (that is a windows form) and i need some code that will just close the xna window but not the form.
I've looked everywhere but can't seem to find an answer. I figured out how to open the form, I just need to close the opened xna window so just my main menu is there and i can start another xna game.
Upvotes: 0
Views: 436
Reputation: 864
There is an answer to your question here. Essentially, you will need to modify the opacity to hide the game window. The game will still be active.
Edit
my game continues to run in the backgound and so on my main menu i can't start another instance of that game
If you need to completely close the XNA game, the game will need to be launched from the Windows Form application. In your Windows Form application you can use:
Game1 myGame = new Game1();
myGame.Run();
to run the XNA game. Then when you use Game.Exit()
(in the XNA application) to close the game, the main menu should still be open in the background.
Upvotes: 2