Events

Introduction

Glue supports the addition of events to screens and entities. Events allow code to respond to game actions, such as the clicking of a button or the removal of an object from a list.

Example

The events available to a screen, entity, or object depend on the respective container’s properties. For example, if an entity implements IWindow (for more information, see the Implements IWindow page), the entity will have additional events available.

Editing Event Code

Every event in Glue creates a corresponding method in your code project which can be edited in Visual Studio. For example, consider the example of a GameScreen which has an event ResolutionOrOrientationChanged:

The presence of this event will result in 2 new code files:

  1.  GameScreen.Event.cs
  2. GameScreen.Generated.Event.cs

As usual, the file with Generated in the name is a generated file which should not be edited because Glue may overwrite any manual changes. The non-generated file (GameScreen.Event.cs) can be freely edited to modify the logic associated with a given event.