Adding FlatRedBall to a MonoGame/FNA Project
Last updated
Last updated
FlatRedBall can be added to any MonoGame/XNA project with only three lines of code. This tutorial describes the process of adding FlatRedBall to a project created from a MonoGame/XNA template.
First we'll download the FlatRedBall .dll files. Note that FlatRedBall provides different files depending on the platform you are targeting.
Go to the prebuilt file location.
Select your platform
Select Debug or Release. You may want to start with Debug, then grab the release .dlls when you are ready to test your game for release.
Download the .dll for FlatRedBall, and the associated .pdb file if you would like additional debugging information.
Note that the folder will include other files, which may be needed if you would like to add FlatRedBall.Forms to your project. However if you are interested in only the core FlatRedBall functionality, you will only need the single .dll.
Most FlatRedBall platforms only require a single - the engine .dll. Add this file to your existing game project's references.
Open your project in Visual Studio
Expand the game project in the Solution Explorer
Right-click on the References item
Select Add Reference...
Select the Browse category
Click the Browse... button
Navigate to where you have downloaded the .dll in the previous steps and select it to add it to your project.
Now that your project is referencing FlatRedBall, add the following code: In Game1.Initialize:
In Game1.Update:
In Game1.Draw:
The default template includes code for clearing the screen in the Draw method. FlatRedBall automatically clears the screen for you, so having the call outside of FlatRedBall is redundant. You can choose if you want FlatRedBall to clear the screen, or if you want your own code to clear the screen.
FlatRedBall automatically clears the screen, so you can remove any code that performs clearing for you, such as:
If you want to clear the screen in your own code, you can tell FlatRedBall to not clear the screen by setting the main camera's background color to transparent: