Introduction
FlatRedBall.Forms is an easy-to-use UI library for games. This tutorial will walk you through setup of a game project including FlatRedBall.Forms.
(Optional) Linking to FlatRedBall.Forms and GumCore Source
FlatRedBall.Forms source code can be linked in your game project if you want cutting-edge features, improved debugging, or to contribute. For information on linking, see the following link:
Creating a Glue Project
First we’ll create a Glue project. If you already have a Glue project you can skip this section.
To create a new project:
- Open Glue
- Select File -> New Project
- Select the Empty Project category
- Select Desktop GL as the project type (additional platforms can be added later)
- Enter a project name such as FormsProject
- Click the Make my Project! button
-
Now we have a project that is ready to go. Note that if you already have an existing FlatRedBall project, you can continue on the next step.
Adding a Gum Project
Next we’ll add a Gum project to the FlatRedBall project. Note that if your project already has a Gum project. To add a project:
- Click the Gum icon in Glue to add a new Gum project
Note that if you already have a Gum project, this icon will open the file in Gum - Click the Gum project and select the Gum Properties tab (this should automatically be selected if you just created the Gum project)
- Click the Add Forms to Project button
Adding a Button
Now that we have a Gum project we’ll add a button to the Gum screen. For this example we’ll add the button purely through Gum (no code involved).
To add a button:
- Right-click on the Glue Screens folder and select Add Screen
- Enter a name for the new screen and click OK
Note that by default this will also create a Gum screen - Click the Gum icon to open Gum
- Click GameScreenGum (the Gum screen for the newly-created Glue screen)
- Expand the Components -> DefaultForms folder
- Drag+drop the Button component onto the GameScreen
The Button should now appear in the Gum.
Running the game will also show a fully-functional button.