I’m evaluating monogame for my company and would like to know if someone could point me towards the relevant documents/examples of creating more than 1 game window? I’ve experimented a bit on my own with using 2 Game instances and telling them to RunOneFrame() over and over but surely there are more idiomatic ways of doing this. I did the normal google/forum search but came up with very little.
I don’t think anyone answered my original question, so I borrowed a technique I’ve used on other libraries before to launch a few windows. Hopefully there isn’t something I’m missing that will bite me later.
public static class Program
private static BlockingCollection<Game1> _games = new BlockingCollection<Game1>();
private static AutoResetEvent _stayAlive = new AutoResetEvent(false);
static void Main()
// Keep the main UI thread alive until we decide we are done.
static void SpawnWindow()
using (var game = new Game1())
game.Exiting += HandleGameExiting;
private static void HandleGameExiting(object sender, EventArgs e)
var game = sender as Game1;
if (game != null)
if(gameToRemove == null)
Console.WriteLine("Failed to remove closing game.");
// If no more windows exist lets close everything down.
if (_games.Count == 0)
It’s simply the game would benefit from having two completely different views open. I could write the game for full 4k split into 4 and show loads of information but that’s completely over the top. To be able to ‘pop up’ a second window for a look at another path of the game while playing could be useful. Think of quickly picking up a map book while driving before we had SatNavs, that kind of thing. You want a quick view of the map without blocking out the road in front of you.
It isn’t a map, or have anything to do with a road, that’s just the best analogy I could think of.
I’ve been pondering this lately as well for the same reasons @willmotil described. Although WPFInterop has been dandy, some of my WPF controls (animation timeline and curve graphs specifically) butcher the daylights out of WPF even after obscene amounts optimization.
It’d be nice to just migrate over to an all/mostly IMGUI-paradigm, but those context menus and dialog windows always rear their heads and WPF is unsuitable for a minimal shell.
Unless anything has radically changed it should just be swapchains and multiple back-buffers for DX. Should be pretty doable in Winforms as WPFInterop does it across multiple controls and reference counting the underlying device. IIRC doing it in OpenGL was even easier, just changing the current context setup, buffers again, and go. I haven’t done any multi-window rendering since at least 2006 though, so WTF do I know about today - probably diddly.
Does suck that all of the examples I find are so incredibly overwrought that I haven’t had the patience to decipher them.
A good use for multiple windows are for realistic simulations where a lot of data has to be presented to the user. By using an interface library, most of the textual data can be represented easily enough.
However, how do you create second game window that relates to the primary game screen? For example, in military simulations such as war games one common attribute to such simulations is what is called a “jump window”, which displays the entire playing map in a secondary small window that allows the player to select an area on the map and immediately “jump” to it in the primary screen.
I would be very interested in seeing a technique for this using MonoGame. Maybe one of the MonoGame developers can answer this type of question…
Ah so this came up again in conversation is there a easy way to do this now or is there a tutorial somewere to get a popout window running i was told it can be done using swapchaintarget but i still have no idea how or what that even means