Setup for GumBatch
Introduction
Gum provides a GumBatch object which works similar to GumBatch. It can be used for immediate mode rendering, which allows for calling Begin
, Draw
, and End
just like SpriteBatch. This is useful if your project requires mixing Gum and MonoGame rendering, or if you are more comfortable using a SpriteBatch-like interface.
This page assumes you have an existing MonoGame project. This can be an empty project or an existing game.
Adding Gum Nuget Packages
Open your MonoGame project in your preferred IDE.
Add the
Gum.MonoGame
NuGet package
GumBatch Quick Start
To initialize a GumBatch, you must:
Declare a GumBatch at class scope
Initialize the Gum SystemManagers - this is needed whether you use GumBatch or the full Gum retained mode rendering system
Initialize the GumBatch
(optional) load a .fnt file
Draw with gumBatch in your Draw
The following shows a simple Game1.cs file which renders Gum Text:
This code produces the following image:
Note that this code assumes a font .fnt file (and matching .png) are in the Content/Fonts/ folder. All content is loaded relative to the Content folder, just like normal content in MonoGame. Also note that this content does not use the content pipeline, but must be set to Copy to Output.
For more information on loading FNT files, see the File Loading documentation.
For a more detailed discussion of using GumBatch, see the GumBatch page.
Last updated