GlueView (officially version 2) is a new set of features added to Glue in late 2021. GlueView allows you to preview your game and entities. It also provides editing abilities for instances and Tiled files.
To use GlueView with all features, your project should use the Screen-as-a-Level pattern. This means that your game has a GameScreen, and that every level in the game is its own Screen such as Level1, Level2, etc. This pattern is recommended for all FlatRedBall projects and it is the pattern used in the platformer tutorials.
Note that you do not necessarily need to use Screen-as-a-Level pattern, but doing so enables the full GlueView feature set.
Enabling Edit Mode
GlueView is technology which is added to your game by Glue through code generation. Once added, your game also acts as a level editor which can receive updates from Glue without restarting. This can greatly improve iteration speed and allows editing to be done in the actual game as opposed to a separate level editor.
To enable edit mode on a project:
- Open your project in Glue
- Select the Build tab in Glue
- Check the Generate GlueControlManager in Game1 checkbox. Note that a port number is displayed. You do not need to change this port unless it defaults to a port that is already being used by another process.
- Run your game from either Visual Studio or Glue – you can do either and Glue will detect that the game is running. When the game is running, the Build tab will change to include new buttons and options.
- Click the Edit button to make the game run in edit mode. The game will display grid lines to indicate that it is in edit mode.
You can switch between Edit and Play mode anytime by changing the selected option.
Selecting and Previewing
GlueView automatically displays the selected level in Edit mode. GlueView responds to the following selections in Glue
- Select an entity to view it in game. The game creates a preview screen allowing you to view and edit the entity by itself.
- States can also be previewed by selecting a state in the StateData editor grid to preview it as well
The Camera in Edit mode can be controlled using the following methods:
Moving and Changing Object Variables
Changes in Glue will immediately apply if the game is in edit mode. GlueView provides the following ways to edit:
- Push+drag to move objects in the game – the variables will update automatically in Glue to match the new position
- Multiple objects can be selected and moved at once by holding down the CTRL key and clicking each object
Creating New Objects
Creating a new object in Glue automatically updates the game with the new object. New objects can be added to levels or entities.
- New objects can be created by using the CTRL+C, CTR+V shortcut in game. This is especially useful when placing multiple objects in game. When pasting a grabbed object, the new object will be placed at the same location as the grabbed object.
Working with Files
GlueView supports adding files at runtime and automatically updating to changes.
- Changes to TMX files which can create entities and collision will automatically update these objects so they can be tested immediately. For example, painting collision tiles immediately allows testing the new level without restarting.