So I want to have a winforms GUI for my game... But I can't seem to find a GUI lib that is tested to work with Monogame. That's why I have another plan:
- Create a WinForms Project to act as a startup for my game.
- Then, when the user clicks "Start Game" in that project's main form, the winforms project should look for my Monogame project executable and start it, then the form should close.
- However I want to pass an argument from the WinForms exe to the Monogame exe. This has the purpose of somewhat preventing users from starting the game through the Monogame exe and use the Winforms "Starter" instead. Which leads to step #4.
- If no argument is passed to the Monogame project it should close.
So should I do it like in console applications, pass a string array to the main void of the Monogame app like this:
using System;
namespace myGame
{
#if WINDOWS || LINUX
/// <summary>
/// The main class.
/// </summary>
public static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main(string[] args)
{
using (var game = new Game1())
game.Run();
if (args[0] != "startFromWinForms")
{
// Find a way to close or
// on the other hand I think
// it will throw an exception??
}
}
}
#endif
}
How would you do that? What approach do you recommend? Also code examples/ideas explained would be great!