Skip to content

Tutorials:Getting Started Guide Linux

Schala edited this page Jan 24, 2013 · 4 revisions

Back to Tutorials Page

Table of Contents

Introduction

This page gives an introduction for how to get started with MonoGame on Linux. The following steps are covered:

  1. Getting and installing the required packages
  2. Setting up an application with MonoGame (stable)
  3. Downloading an compiling the latest source files for MonoGame (develop3d)
  4. Setting up an application with MonoGame (develop3d)
  5. Updating the source files
These steps are demonstrated on a Linux Mint 13 machine. While they will be very similar on any other Ubuntu based OS, there may be more significant differences with other distributions of Linux.

Required Packages

The following packages are needed for setting up a MonoGame application with the current version of MonoGame

  • monodevelop
  • monogame on Arch Linux AUR (monodevelop-monogame on Mint 13)
In addition, for compiling the latest sources, we will also be using
  • monodevelop-versioncontrol
The easiest way to install these packages is by using your package manager. This will also ensure that any required dependencies are installed along with them. If you are not using your package manager to download and install MonoGame, note that you will also require OpenTK which can be downloaded directly from the official website at http://www.opentk.com

In order to install the packages with the package manager

  1. Start your Synapctic Package Manager either from the Mint/Ubuntu menu, or by entering sudo synaptic into a terminal.
  2. Since the standard Ubuntu repositories do not cover the latest MonoDevelop packages, we'll need to add a custom repository that does. Head over to http://badgerports.org/ and follow the instructions for adding their repository (How do I use badgerports?).
  3. With the badgerports repository in place, mark the three packages listed above for installation and press Apply.
We are now ready to start MonoDevelop and create our first application with MonoGame.

Creating a MonoGame Application (stable version)

  1. Launch MonoDevelop either from your Mint/Ubuntu menu or by typing monodevelop into a terminal.
  2. Create a new project, or solution, by choosing File -> New -> Solution from the drop-down menus.
  3. If you have used your package manager for installation, you will find that there already is a template available for MonoGame solutions under Linux: C# -> MonoGame -> MonoGame Linux Application.
  4. Select a suitable name and location for your solution, press Forward, and choose OK on the following dialogue.
You now have a working solution already set up with the required references for a MonoGame application to work. In principle you can compile and run the application as is. However, you may want to set

graphics.IsFullScreen = false

while familiarising yourself with the IDE.

To launch the application, press F5 or select Run -> Start Debugging.

Getting and Building the Latest Sources (develop3d)

We will be using the Version Control plugin of MonoDevelop as a convenient way to download the latest MonoGame sources.

  1. From the drop-down menu select Version Control -> Checkout.
  2. Enter the path to the MonoGame git repository into the Url field (git://github.com/mono/MonoGame.git) and choose a target directory for the files to be checked out into. Press OK.
  3. Open the MonoGame Linux solution of MonoGame by choosing File -> Open and selecting the MonoGame.Framework.Linux.sln in the target location specified by you during checkout.
  4. Set the Active Configuration drop-down box from Debug|x86 to Release|x86 and build the complete solution by hitting F8 or selecting Build -> Build All.
  5. If there are no errors, you have successfully built the MonoGame .dll files. You can now go on and include them in your project. How this step works is described in the next part.

Creating a MonoGame Application (develop3d version)

Creating a MonoGame solution using the current develop3d version works almost the same way as creating one that is using the stable version. The only difference is that we exchange the .dll files that are used with those of the develop3d version which we have compiled in the previous step.

  1. Create a new solution from the MonoGame Linux Application template as shown previously.
  2. In order to exchange the .dll files, we need to adjust the respective references to these files. To do so, right-click on the References item in the solution tree and select Edit References, or choose Project -> Edit References from the drop-down menu.
  3. Delete the following items from the list
    • MonoGame.Framework.Linux
    • Lidgren.Network
    • Tao.Sdl
  4. Replace them with the ones we compiled previously by choosing the .Net Assembly tab, browsing into your MonoGame.Framework/bin/Release/ folder and adding the .dll files found therein.
Your solution is now using the .dll files from the develop3d version of MonoGame.

Keeping the Sources Up-to-date

You can use the Version Control plugin of MonoDevelop to keep up-to-date with the latest changes in the develop3d version of MonoGame.

  1. Open the MonoGame.Framework.Linux.sln
  2. Choose Version Control -> Update Solution from the drop-down menu. Doing so will update the solution to the latest one available from the repository.
  3. In order for your own application to use that latest version, build the MonoGame solution once more.
Updating the references in your application is not necessary, as MonoDevelop will find the new .dll files in the same place as before.

Back to Tutorials Page

Clone this wiki locally