# CCSpriteBatchNode Class Reference

Inherits from | CCNode : CCResponder : NSObject
Conforms to | CCBlendProtocol CCTextureProtocol
Declared in | CCSpriteBatchNode.h

## Overview

A CCSpriteBatchNode offers improved rendering performance for multiple sprite rendering by utilising a single OpenGL call to render all sprites from one (and only one) texture (one image file, one texture atlas), often knows as a ‘batch draw’.

### Notes

- Only CCSprites or any subclass of CCSprite may be added to the CCSpriteBatchNode.
- All CCSprites must reference the same texture atlas.
- Default child capacity is 29 children and will be increased by 33% at runtime each time capacity is reached.

## Tasks

### Creating a CCSpriteBatchNode Object

- `+ batchNodeWithTexture:`
- `+ batchNodeWithFile:`

### Initializing a CCSpriteBatchNode Object

- `– initWithTexture:capacity:`
- `– initWithFile:capacity:`

## Class Methods

### batchNodeWithFile:

Creates and returns a batch node with the specified image file value.

`+ (id)batchNodeWithFile:(NSString *)fileImage`

#### Parameters

fileImage

  Image file name.

#### Return Value

The CCSpriteBatchNode Object.

#### Declared In

`CCSpriteBatchNode.h`

### batchNodeWithTexture:

Creates and returns a batch node with the specified texture value.

`+ (id)batchNodeWithTexture:(CCTexture *)tex`

#### Parameters

tex

  Texture to use.

#### Return Value

The CCSpriteBatchNode Object.

#### Declared In

`CCSpriteBatchNode.h`

## Instance Methods

### initWithFile:capacity:

Creates and returns a batch node with the specified texture and capacity values.

`- (id)initWithFile:(NSString *)fileImage capacity:(NSUInteger)capacity`

#### Parameters

fileImage

  Image file name.

capacity

  Initial capacity.

#### Return Value

An initialized CCSpriteBatchNode Object.

#### Declared In

`CCSpriteBatchNode.h`

### initWithTexture:capacity:

Creates and returns a batch node with the specified texture and capacity values.

`- (id)initWithTexture:(CCTexture *)tex capacity:(NSUInteger)capacity`

#### Parameters

tex

  Texture to use.

capacity

  Initial capacity.

#### Return Value

An initialized CCSpriteBatchNode Object.

#### Declared In

`CCSpriteBatchNode.h`