Creating a FlatRedBall Project
Last updated
Last updated
This tutorial walks you through installing and creating an empty FlatRedBall project.
If you would like to avoid using the FlatRedBall Editor completely, or if you are running on Linux or Mac, then you can directly download a project template .zip file. To do this:
Select your target platform. For example, if developing for desktop select https://files.flatredball.com/content/FrbXnaTemplates/DailyBuild/ZippedTemplates/FlatRedBallDesktopGlNet6Template.zip
Download and unzip the file to your machine
Open the .sln in Visual Studio or Visual Studio Code (see below for Visual Studio Code instructions)
Visual Studio is not a requirement for using FlatRedBall. You can write, compile, and run FlatRedBall projects using Visual Studio code. To do so:
Install Visual Studio Code
Install Visual Studio Code C# Dev Kit https://marketplace.visualstudio.com/items?itemName=ms-dotnettools.csdevkit&ssr=false#overview
Make sure you have .NET SDK 6 installed. If you are targeting iOS, Android, or Web then you must have .NET 8 SDK installed.
Open the folder where the .sln is located for your project.
Select the folder where you have unzipped your project earlier.
If asked, check Yes, I trust the authors.
If you have an existing MonoGame project, you can add FlatRedBall with the following steps:
Open your MonoGame project in Visual Studio
Add FlatRedBall reference to your project
If targeting Desktop GL, you can add FlatRedBall through the FlatRedBall NuGet package\
If targeting other platforms, you will need to manually add the FlatRedBall .dlls to your project:
Download the .dll for the project you are working on from this folder: https://files.flatredball.com/content/FrbXnaTemplates/DailyBuild/SingleDlls/
Save the .dll to a location relative to your project, such as a Libraries folder
Link your game project to the newly-downloaded .dll
Modify Game1
so it contains the following calls:
In Initialize before base.Initialize()
:
In Update before base.Update(gameTime)
:
In Draw before base.Draw(gameTime)
:
FlatRedBall requires a shader file for rendering. You need to add this to your project. To do this:
Download the compiled shader XNB file from: https://github.com/vchelaru/FlatRedBall/blob/NetStandard/Templates/FlatRedBallDesktopGlNet6Template/FlatRedBallDesktopGlNet6Template/Content/shader.xnb
Save this to your Content folder in your project
Add this file to your Visual Studio project (.csproj)
Mark the file as Copy if newer
To run your newly-created project:
Double-click the .sln file to open it in Visual Studio
Once your project opens, click the Start button in Visual Studio
Your project should compile and run, displaying an empty (black) screen.
If you would like to run your project without Visual Studio, you can use the dotnet build command line, but you must first install the .NET 6 SDK. https://dotnet.microsoft.com/en-us/download/dotnet/thank-you/sdk-6.0.308-windows-x64-installer Once you have installed it, you can run the dotnet command to build your project. To build your project
Open a command window (like Windows PowerShell)
Go to the folder where your .sln is located
Type the command dotnet build YourSolutionFile.sln
This should produce a .exe which you can then run.