Setup
Last updated
Last updated
This page assumes you have an existing MonoGame project. This can be an empty project or an existing game.
At the time of this writing Gum + MonoGame has been tested on a variety of platforms including DesktopGL, DirectX, and mobile. It has also been used with Nez and Kni. If your particular platform is not supported please contact us on Discord and we will do our best to add support.
Open your MonoGame project in your preferred IDE.
Add the Gum.MonoGame
NuGet package
Open your Game class (usually Game1.cs)
Add the following code to your Initialize method:
SystemManagers.Default = new SystemManagers(); SystemManagers.Default.Initialize(_graphics.GraphicsDevice, fullInstantiation: true);
Add the following to your Update method:
SystemManagers.Default.Activity(gameTime.TotalGameTime.TotalSeconds);
Add the following to your Draw method after you clear the graphics device:
SystemManagers.Default.Draw();
To test that you have successfully added Gum to the project, add the following code to your Initialize method after SystemManagers.Default.Initialize:
If everything is initialized correctly, you should see a white rectangle at the top-left of the screen.
This page shows the minimum code needed to get Gum up and running in your project. If you want to load a Gum project created in the Gum tool, see the Loading a Gum Project page.
The Gum tool can be used to create Gum projects which can be loaded into your MonoGame project. To download and run the Gum tool, see the Setup page.