FormClosed
event and double-click in the empty box to the right of the event name to create the MapEditor_FormClosed()
event handler.private void MapEditor_FormClosed( object sender, FormClosedEventArgs e) { game.Exit(); Application.Exit(); }
When the form closes, we need to shut down both the XNA game and the overall application, otherwise the system will not release the resources, and the program will still be running invisibly in the background.
The Gemstone Hunter Level Editor project is fairly rough around the edges. It is not exactly a model example of Windows Forms development, but then few purpose-built internal game development tools are.
If you feel like diving further into Windows Forms development, here are a few suggestions for improving on the level editor:
Update()
method of the Game1 class, you could flag the map as having changed and issue the appropriate warnings to the user when they try to load a new map.3.134.78.106