The ImplementsIDrawableBatch property can be set to true for entities which require custom rendering code. If this value is true, Glue will generate most of the code necessary for implementing IDrawable batch, including:

  • All necessary properties
  • Empty implementation for IDrawableBatch.Update and IDrawableBatch.Update and IDrawableBatch.Destroy. These are are empty since entities already have update and destroy methods.
  • Addition of the entity to the SpriteManager as an IDrawableBatch
  • Removal of the entity to the SpriteManager as an IDrawableBatch

Setting ImplementsIDrawableBatch to true does not result in code generation writing a Draw method implementation, so this must be implemented in custom code.

Implementation Example

The following instructions show how to use the ImplementsIDrawableBatch property to create an entity which is drawn using the SpriteBatch class.

Before writing code, the following steps are needed to create an IDrawableBatch entity:

  1. Create an Entity in Glue
  2. Set the Entity’s ImplementsIDrawableBatch property to true

  3. Add a .png file to the entity. This will be used in the Draw call

Once the entity has been created, its Draw call must be defined in code. Notice that the Draw method has a Camera parameter. This allows entities to perform rendering relative to the current Camera. In this example the entity ignores the Camera for simplicity.