Files

Introduction

Files added to Glue will be managed for you automatically, simplifying the game development process. When a file is added to Glue the following occurs:

  • Glue lists the file in the Glue UI
  • The file is added to the proper Visual Studio/Xamarin Studio project
  • A static member is added for the file in the appropriate screen, entity, or global content
  • Code for loading the file is generated automatically

Supported File Types

  • bmp
  • png
  • jpg
  • scnx
  • shcx
  • achx
  • emix
  • splx
  • csv
  • mp3
  • wav

Accessing Files in Code

Files in Glue can be accessed in code. Files added to global content can be accessed in any location. Files added to screens and entities can safely be accessed within the respective screen or entity’s custom code. Files from other screens or entities can be accessed so long as the owning screen or entity has had its LoadStaticContent method called.

Accessing Files in Their Screen or Entity

Files added to a Screen or Entity create a member which can be accessed in code. For example, if a .png file is added to an Entity, it can be used to assign a texture on a sprite. In the example below, Glue will generate code for a Texture2D  called MonsterTexture .

Accessing Global Content Files

Global content files are loaded when the game first starts, and remain in memory for the remainder of a game’s execution, so they can be accessed at any time. For example, the following CSV named EnemyInfo is part of global content:

This can be accessed anywhere in a game with the following code:

Shared Files

Single files can be shared across multiple Screens, Entities, and Global Content. For example, a file may be added to Global Content Files, but then also added to an Entity to be accessible by that Entity in Glue:

SharedGlueFiles.gif

File Folders

The “Files” tree node supports folders. To add a folder:

  1. Right-click on the “Files” node
  2. Enter the name of the folder
  3. Click OK

This will create a folder both in Glue as well as on the file system.

FileFoldersGlueAndWindows.PNG

Name

The Name of a file in Glue will reflect its location. For example, the following shows a file located in the Animations folder of a Ball entity:

GlueFileNameWithFolders.png

Shared files will display the name of their location on disk. For example the following shows a file which is located in Global Content, but shared with an entity. When the shared copy is selected the file’s actual location is show in the Name property:

GlueSharedBallName.png