Geeks With Blogs


Google My Blog

Catch me at: The List!

My InstallScript Utility Belt My Amazon Wishlist
My Standard Disclaimer

Chris G. Williams Beware: I mix tech and personal interests here.

MonoGame - What’s in the Starting Project?

Now that you have MonoGame & Visual Studio installed, go ahead and create a MonoGame Windows Project. You can call it whatever you want.

In the Solution Explorer, you’ll see a Content folder (more on this in a bit), an icon file (put your cursor on it), and finally two .cs files: Program.cs and Game1.cs

Program.cs is our game launcher. Go ahead and click on it. There’s not much there, other than a call to your Game1() class, and you will rarely have to do anything in this file.



The other file, Game1.cs, is a lot more interesting. This is where we’ll be spending most of our time. Go ahead and click on it and take a look around.

The first thing you’ll probably notice are the namespace references at the top of the page.


Even though there’s no actual dependancy on XNA in MonoGame, the decision was made to keep the namespaces in order to ensure maximum conpatibility with existing XNA code.

Next up, we have the GraphicsDeviceManager and SpriteBatch. Those will be discussed further in a later article.

The constructor is pretty basic, and includes a reference to the GraphicsDeviceManager and the Content folder.


There are five methods in this class, which I’ll cover now.

Initialize() – This method is called ONCE, when your game first starts up. Use it to set up any services or external things like non-graphical content.


LoadContent() – This is where you would load your games graphical content, such as sprites, spritefonts (more on those later), and 3D models.


UnloadContent() – THis is where you unload the content you referenced in the LoadContent() method.


Update() – After loading your assets, much of your coding will occur here. This is where you check for user input, and also update the state of objects being used in your game.


Draw() – This is where you draw onscreen, using the data you updated in the Update() method.


These last two methods, Update() and Draw(), form what is known as the game loop, which I’ll cover in the next section.

Next up…

I’ll cover the Game Loop. If you came directly to this page, you can find the complete list of articles here.

Posted on Tuesday, February 7, 2017 12:29 PM Game Development , MonoGame | Back to top

Comments on this post: 4. MonoGame - What’s in the Starting Project?

# re: 4. What’s in the Starting Project?
Requesting Gravatar...
You hooked me. I look forward to the rest of the series.
Left by Gavin on Feb 11, 2017 1:49 AM

Your comment:
 (will show your gravatar)

Copyright © Chris G. Williams | Powered by: