> For the complete documentation index, see [llms.txt](https://docs.flatredball.com/flatredball/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.flatredball.com/flatredball/glue-reference/entities/implementsidrawablebatch.md).

# Implements IDrawableBatch

### Introduction

The **Implements IDrawableBatch** tells the FlatRedBall Editor to generate code for custom rendering including:

* All necessary properties for the IDrawableBatch interface
* Empty implementation for 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, or select an existing entity which should have is own Draw method
2. Set the Entity's **ImplementsIDrawableBatch** property to T**rue**

   ![](https://951240982-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M_fye9Ufg3vzJxwX5Hk%2Fuploads%2Fgit-blob-bf05b54b33cb59133e3b12eb946a0858a854d665%2F2016-06-img_576b65577329a.png?alt=media)
3. Add a .png file to the entity. This will be used in the Draw call

Once the entity has been created, we must define a Draw call in the entity's code file. 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.

```csharp
public partial class PostProcessingEntity
{
    SpriteBatch spriteBatch;

    private void CustomInitialize()
    {
        spriteBatch = new SpriteBatch(FlatRedBallServices.GraphicsDevice);
    }

    private void CustomActivity()
    {
    }

    private void CustomDestroy()
    {
        spriteBatch.Dispose();
    }

    private static void CustomLoadStaticContent(string contentManagerName)
    {
    }

    public void Draw(Camera camera)
    {
        spriteBatch.Begin();

        spriteBatch.Draw(
            TilesImage, 
            new Rectangle(50, 50, TilesImage.Width, TilesImage.Height), 
            Color.White);

        spriteBatch.End();
    }
}
```

### Additional Information

For more information and code samples related to IDrawableBatch, see the [IDrawableBatch](/flatredball/api/flatredball/graphics/drawablebatch.md) page.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.flatredball.com/flatredball/glue-reference/entities/implementsidrawablebatch.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
