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.
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:
- Create an Entity in Glue
- Set the Entity’s ImplementsIDrawableBatch property to true
- 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.
public partial class PostProcessingEntity
private void CustomInitialize()
spriteBatch = new SpriteBatch(FlatRedBallServices.GraphicsDevice);
private void CustomActivity()
private void CustomDestroy()
private static void CustomLoadStaticContent(string contentManagerName)
public void Draw(Camera camera)
new Rectangle(50, 50, TilesImage.Width, TilesImage.Height),