A class that implements a Texture Atlas. More...
#include <CCTextureAtlas.h>
Public Member Functions | |
virtual unsigned int | getTotalQuads (void) |
getTotalQuads More... | |
virtual unsigned int | getCapacity (void) |
getCapacity More... | |
virtual CCTexture2D * | getTexture (void) |
getTexture More... | |
virtual void | setTexture (CCTexture2D *var) |
setTexture More... | |
local | setTexture ( local var) |
setTexture More... | |
virtual ccV3F_C4B_T2F_Quad * | getQuads (void) |
getQuads More... | |
local | getQuads () |
getQuads More... | |
virtual void | setQuads (ccV3F_C4B_T2F_Quad *var) |
setQuads More... | |
local | setQuads ( local var) |
setQuads More... | |
CCTextureAtlas () | |
virtual | ~CCTextureAtlas () |
const char * | description () |
bool | initWithFile (const char *file, unsigned int capacity) |
initializes a TextureAtlas with a filename and with a certain capacity for Quads. More... | |
bool | initWithTexture (CCTexture2D *texture, unsigned int capacity) |
initializes a TextureAtlas with a previously initialized Texture2D object, and with an initial capacity for Quads. More... | |
void | updateQuad (ccV3F_C4B_T2F_Quad *quad, unsigned int index) |
updates a Quad (texture, vertex and color) at a certain index index must be between 0 and the atlas capacity - 1 More... | |
void | insertQuad (ccV3F_C4B_T2F_Quad *quad, unsigned int index) |
Inserts a Quad (texture, vertex and color) at a certain index index must be between 0 and the atlas capacity - 1 More... | |
local | insertQuad ( local quad, local index) |
Inserts a Quad (texture, vertex and color) at a certain index index must be between 0 and the atlas capacity - 1 More... | |
void | insertQuads (ccV3F_C4B_T2F_Quad *quads, unsigned int index, unsigned int amount) |
Inserts a c array of quads at a given index index must be between 0 and the atlas capacity - 1 this method doesn't enlarge the array when amount + index > totalQuads. More... | |
void | insertQuadFromIndex (unsigned int fromIndex, unsigned int newIndex) |
Removes the quad that is located at a certain index and inserts it at a new index This operation is faster than removing and inserting in a quad in 2 different steps More... | |
void | removeQuadAtIndex (unsigned int index) |
removes a quad at a given index number. More... | |
void | removeQuadsAtIndex (unsigned int index, unsigned int amount) |
removes a amount of quads starting from index More... | |
void | removeAllQuads () |
removes all Quads. More... | |
bool | resizeCapacity (unsigned int n) |
resize the capacity of the CCTextureAtlas. More... | |
void | increaseTotalQuadsWith (unsigned int amount) |
Used internally by CCParticleBatchNode don't use this unless you know what you're doing. More... | |
void | moveQuadsFromIndex (unsigned int oldIndex, unsigned int amount, unsigned int newIndex) |
Moves an amount of quads from oldIndex at newIndex. More... | |
void | moveQuadsFromIndex (unsigned int index, unsigned int newIndex) |
Moves quads from index till totalQuads to the newIndex Used internally by CCParticleBatchNode This method doesn't enlarge the array if newIndex + quads to be moved > capacity. More... | |
void | fillWithEmptyQuadsFromIndex (unsigned int index, unsigned int amount) |
Ensures that after a realloc quads are still empty Used internally by CCParticleBatchNode. More... | |
void | drawNumberOfQuads (unsigned int n) |
draws n quads n can't be greater than the capacity of the Atlas More... | |
void | drawNumberOfQuads (unsigned int n, unsigned int start) |
draws n quads from an index (offset). More... | |
void | drawQuads () |
draws all the Atlas's Quads More... | |
void | listenBackToForeground (CCObject *obj) |
listen the event that coming to foreground on Android More... | |
var | listenBackToForeground ( var obj) |
listen the event that coming to foreground on Android More... | |
local | listenBackToForeground ( local obj) |
listen the event that coming to foreground on Android More... | |
bool | isDirty (void) |
whether or not the array buffer of the VBO needs to be updated More... | |
void | setDirty (bool bDirty) |
specify if the array buffer of the VBO needs to be updated More... | |
Public Member Functions inherited from CCObject | |
CCObject (void) | |
virtual | ~CCObject (void) |
void | release (void) |
void | retain (void) |
CCObject * | autorelease (void) |
CCObject * | copy (void) |
bool | isSingleReference (void) const |
unsigned int | retainCount (void) const |
virtual bool | isEqual (const CCObject *pObject) |
virtual void | acceptVisitor (CCDataVisitor &visitor) |
virtual void | update (float dt) |
Public Member Functions inherited from CCCopying | |
virtual CCObject * | copyWithZone (CCZone *pZone) |
Static Public Member Functions | |
static CCTextureAtlas * | create (const char *file, unsigned int capacity) |
creates a TextureAtlas with an filename and with an initial capacity for Quads. More... | |
var | create ( var file, var capacity) |
creates a TextureAtlas with an filename and with an initial capacity for Quads. More... | |
local | create ( local file, local capacity) |
creates a TextureAtlas with an filename and with an initial capacity for Quads. More... | |
static CCTextureAtlas * | createWithTexture (CCTexture2D *texture, unsigned int capacity) |
creates a TextureAtlas with a previously initialized Texture2D object, and with an initial capacity for n Quads. More... | |
local | createWithTexture ( local texture, local capacity) |
creates a TextureAtlas with a previously initialized Texture2D object, and with an initial capacity for n Quads. More... | |
Protected Attributes | |
GLushort * | m_pIndices |
GLuint | m_pBuffersVBO [2] |
var | m_pBuffersVBO () |
local | m_pBuffersVBO () |
bool | m_bDirty |
unsigned int | m_uTotalQuads |
quantity of quads that are going to be drawn More... | |
var | m_uTotalQuads |
quantity of quads that are going to be drawn More... | |
local | m_uTotalQuads |
quantity of quads that are going to be drawn More... | |
unsigned int | m_uCapacity |
quantity of quads that can be stored with the current texture atlas size More... | |
CCTexture2D * | m_pTexture |
Texture of the texture atlas. More... | |
ccV3F_C4B_T2F_Quad * | m_pQuads |
Quads that are going to be rendered. More... | |
var | m_pQuads |
Quads that are going to be rendered. More... | |
local | m_pQuads |
Quads that are going to be rendered. More... | |
Protected Attributes inherited from CCObject | |
unsigned int | m_uReference |
unsigned int | m_uAutoReleaseCount |
Additional Inherited Members | |
Public Attributes inherited from CCObject | |
unsigned int | m_uID |
int | m_nLuaID |
A class that implements a Texture Atlas.
Supported features: The atlas file can be a PVRTC, PNG or any other format supported by Texture2D Quads can be updated in runtime Quads can be added in runtime Quads can be removed in runtime Quads can be re-ordered in runtime The TextureAtlas capacity can be increased or decreased in runtime OpenGL component: V3F, C4B, T2F. The quads are rendered using an OpenGL ES VBO. To render the quads using an interleaved vertex array list, you should modify the ccConfig.h file
CCTextureAtlas | ( | ) |
var ctor | ( | ) |
local CCTextureAtlas | ( | ) |
|
virtual |
|
static |
creates a TextureAtlas with an filename and with an initial capacity for Quads.
The TextureAtlas capacity can be increased in runtime.
|
static |
creates a TextureAtlas with an filename and with an initial capacity for Quads.
The TextureAtlas capacity can be increased in runtime.
|
static |
creates a TextureAtlas with an filename and with an initial capacity for Quads.
The TextureAtlas capacity can be increased in runtime.
|
static |
creates a TextureAtlas with a previously initialized Texture2D object, and with an initial capacity for n Quads.
The TextureAtlas capacity can be increased in runtime.
|
static |
creates a TextureAtlas with a previously initialized Texture2D object, and with an initial capacity for n Quads.
The TextureAtlas capacity can be increased in runtime.
|
static |
creates a TextureAtlas with a previously initialized Texture2D object, and with an initial capacity for n Quads.
The TextureAtlas capacity can be increased in runtime.
const char* description | ( | ) |
void drawNumberOfQuads | ( | unsigned int | n) |
draws n quads n can't be greater than the capacity of the Atlas
var drawNumberOfQuads | ( | var | n) |
draws n quads n can't be greater than the capacity of the Atlas
local drawNumberOfQuads | ( | local | n) |
draws n quads n can't be greater than the capacity of the Atlas
void drawNumberOfQuads | ( | unsigned int | n, |
unsigned int | start | ||
) |
draws n quads from an index (offset).
n + start can't be greater than the capacity of the atlas
var drawNumberOfQuads | ( | var | n, |
var | start | ||
) |
draws n quads from an index (offset).
n + start can't be greater than the capacity of the atlas
local drawNumberOfQuads | ( | local | n, |
local | start | ||
) |
draws n quads from an index (offset).
n + start can't be greater than the capacity of the atlas
void drawQuads | ( | ) |
draws all the Atlas's Quads
var drawQuads | ( | ) |
draws all the Atlas's Quads
local drawQuads | ( | ) |
draws all the Atlas's Quads
void fillWithEmptyQuadsFromIndex | ( | unsigned int | index, |
unsigned int | amount | ||
) |
Ensures that after a realloc quads are still empty Used internally by CCParticleBatchNode.
var fillWithEmptyQuadsFromIndex | ( | var | index, |
var | amount | ||
) |
Ensures that after a realloc quads are still empty Used internally by CCParticleBatchNode.
local fillWithEmptyQuadsFromIndex | ( | local | index, |
local | amount | ||
) |
Ensures that after a realloc quads are still empty Used internally by CCParticleBatchNode.
|
virtual |
getCapacity
|
virtual |
getCapacity
|
virtual |
getCapacity
|
virtual |
getQuads
|
virtual |
getQuads
|
virtual |
getQuads
|
virtual |
getTexture
|
virtual |
getTexture
|
virtual |
getTexture
|
virtual |
getTotalQuads
|
virtual |
getTotalQuads
|
virtual |
getTotalQuads
void increaseTotalQuadsWith | ( | unsigned int | amount) |
Used internally by CCParticleBatchNode don't use this unless you know what you're doing.
var increaseTotalQuadsWith | ( | var | amount) |
Used internally by CCParticleBatchNode don't use this unless you know what you're doing.
local increaseTotalQuadsWith | ( | local | amount) |
Used internally by CCParticleBatchNode don't use this unless you know what you're doing.
bool initWithFile | ( | const char * | file, |
unsigned int | capacity | ||
) |
initializes a TextureAtlas with a filename and with a certain capacity for Quads.
The TextureAtlas capacity can be increased in runtime.
WARNING: Do not reinitialize the TextureAtlas because it will leak memory (issue #706)
var initWithFile | ( | var | file, |
var | capacity | ||
) |
initializes a TextureAtlas with a filename and with a certain capacity for Quads.
The TextureAtlas capacity can be increased in runtime.
WARNING: Do not reinitialize the TextureAtlas because it will leak memory (issue #706)
local initWithFile | ( | local | file, |
local | capacity | ||
) |
initializes a TextureAtlas with a filename and with a certain capacity for Quads.
The TextureAtlas capacity can be increased in runtime.
WARNING: Do not reinitialize the TextureAtlas because it will leak memory (issue #706)
bool initWithTexture | ( | CCTexture2D * | texture, |
unsigned int | capacity | ||
) |
initializes a TextureAtlas with a previously initialized Texture2D object, and with an initial capacity for Quads.
The TextureAtlas capacity can be increased in runtime.
WARNING: Do not reinitialize the TextureAtlas because it will leak memory (issue #706)
var initWithTexture | ( | var | texture, |
var | capacity | ||
) |
initializes a TextureAtlas with a previously initialized Texture2D object, and with an initial capacity for Quads.
The TextureAtlas capacity can be increased in runtime.
WARNING: Do not reinitialize the TextureAtlas because it will leak memory (issue #706)
local initWithTexture | ( | local | texture, |
local | capacity | ||
) |
initializes a TextureAtlas with a previously initialized Texture2D object, and with an initial capacity for Quads.
The TextureAtlas capacity can be increased in runtime.
WARNING: Do not reinitialize the TextureAtlas because it will leak memory (issue #706)
void insertQuad | ( | ccV3F_C4B_T2F_Quad * | quad, |
unsigned int | index | ||
) |
Inserts a Quad (texture, vertex and color) at a certain index
index must be between 0 and the atlas capacity - 1
var insertQuad | ( | var | quad, |
var | index | ||
) |
Inserts a Quad (texture, vertex and color) at a certain index
index must be between 0 and the atlas capacity - 1
local insertQuad | ( | local | quad, |
local | index | ||
) |
Inserts a Quad (texture, vertex and color) at a certain index
index must be between 0 and the atlas capacity - 1
void insertQuadFromIndex | ( | unsigned int | fromIndex, |
unsigned int | newIndex | ||
) |
Removes the quad that is located at a certain index and inserts it at a new index
This operation is faster than removing and inserting in a quad in 2 different steps
var insertQuadFromIndex | ( | var | fromIndex, |
var | newIndex | ||
) |
Removes the quad that is located at a certain index and inserts it at a new index
This operation is faster than removing and inserting in a quad in 2 different steps
local insertQuadFromIndex | ( | local | fromIndex, |
local | newIndex | ||
) |
Removes the quad that is located at a certain index and inserts it at a new index
This operation is faster than removing and inserting in a quad in 2 different steps
void insertQuads | ( | ccV3F_C4B_T2F_Quad * | quads, |
unsigned int | index, | ||
unsigned int | amount | ||
) |
Inserts a c array of quads at a given index index must be between 0 and the atlas capacity - 1 this method doesn't enlarge the array when amount + index > totalQuads.
var insertQuads | ( | var | quads, |
var | index, | ||
var | amount | ||
) |
Inserts a c array of quads at a given index index must be between 0 and the atlas capacity - 1 this method doesn't enlarge the array when amount + index > totalQuads.
local insertQuads | ( | local | quads, |
local | index, | ||
local | amount | ||
) |
Inserts a c array of quads at a given index index must be between 0 and the atlas capacity - 1 this method doesn't enlarge the array when amount + index > totalQuads.
|
inline |
whether or not the array buffer of the VBO needs to be updated
|
inline |
whether or not the array buffer of the VBO needs to be updated
|
inline |
whether or not the array buffer of the VBO needs to be updated
void listenBackToForeground | ( | CCObject * | obj) |
listen the event that coming to foreground on Android
var listenBackToForeground | ( | var | obj) |
listen the event that coming to foreground on Android
local listenBackToForeground | ( | local | obj) |
listen the event that coming to foreground on Android
void moveQuadsFromIndex | ( | unsigned int | oldIndex, |
unsigned int | amount, | ||
unsigned int | newIndex | ||
) |
Moves an amount of quads from oldIndex at newIndex.
var moveQuadsFromIndex | ( | var | oldIndex, |
var | amount, | ||
var | newIndex | ||
) |
Moves an amount of quads from oldIndex at newIndex.
local moveQuadsFromIndex | ( | local | oldIndex, |
local | amount, | ||
local | newIndex | ||
) |
Moves an amount of quads from oldIndex at newIndex.
void moveQuadsFromIndex | ( | unsigned int | index, |
unsigned int | newIndex | ||
) |
Moves quads from index till totalQuads to the newIndex Used internally by CCParticleBatchNode This method doesn't enlarge the array if newIndex + quads to be moved > capacity.
var moveQuadsFromIndex | ( | var | index, |
var | newIndex | ||
) |
Moves quads from index till totalQuads to the newIndex Used internally by CCParticleBatchNode This method doesn't enlarge the array if newIndex + quads to be moved > capacity.
local moveQuadsFromIndex | ( | local | index, |
local | newIndex | ||
) |
Moves quads from index till totalQuads to the newIndex Used internally by CCParticleBatchNode This method doesn't enlarge the array if newIndex + quads to be moved > capacity.
void removeAllQuads | ( | ) |
removes all Quads.
The TextureAtlas capacity remains untouched. No memory is freed. The total number of quads to be drawn will be 0
var removeAllQuads | ( | ) |
removes all Quads.
The TextureAtlas capacity remains untouched. No memory is freed. The total number of quads to be drawn will be 0
local removeAllQuads | ( | ) |
removes all Quads.
The TextureAtlas capacity remains untouched. No memory is freed. The total number of quads to be drawn will be 0
void removeQuadAtIndex | ( | unsigned int | index) |
removes a quad at a given index number.
The capacity remains the same, but the total number of quads to be drawn is reduced in 1
var removeQuadAtIndex | ( | var | index) |
removes a quad at a given index number.
The capacity remains the same, but the total number of quads to be drawn is reduced in 1
local removeQuadAtIndex | ( | local | index) |
removes a quad at a given index number.
The capacity remains the same, but the total number of quads to be drawn is reduced in 1
void removeQuadsAtIndex | ( | unsigned int | index, |
unsigned int | amount | ||
) |
removes a amount of quads starting from index
var removeQuadsAtIndex | ( | var | index, |
var | amount | ||
) |
removes a amount of quads starting from index
local removeQuadsAtIndex | ( | local | index, |
local | amount | ||
) |
removes a amount of quads starting from index
bool resizeCapacity | ( | unsigned int | n) |
resize the capacity of the CCTextureAtlas.
The new capacity can be lower or higher than the current one It returns YES if the resize was successful. If it fails to resize the capacity it will return NO with a new capacity of 0.
var resizeCapacity | ( | var | n) |
resize the capacity of the CCTextureAtlas.
The new capacity can be lower or higher than the current one It returns YES if the resize was successful. If it fails to resize the capacity it will return NO with a new capacity of 0.
local resizeCapacity | ( | local | n) |
resize the capacity of the CCTextureAtlas.
The new capacity can be lower or higher than the current one It returns YES if the resize was successful. If it fails to resize the capacity it will return NO with a new capacity of 0.
|
inline |
specify if the array buffer of the VBO needs to be updated
|
inline |
specify if the array buffer of the VBO needs to be updated
|
inline |
specify if the array buffer of the VBO needs to be updated
|
virtual |
setQuads
|
virtual |
setQuads
|
virtual |
setQuads
|
virtual |
setTexture
|
virtual |
setTexture
|
virtual |
setTexture
void updateQuad | ( | ccV3F_C4B_T2F_Quad * | quad, |
unsigned int | index | ||
) |
updates a Quad (texture, vertex and color) at a certain index index must be between 0 and the atlas capacity - 1
var updateQuad | ( | var | quad, |
var | index | ||
) |
updates a Quad (texture, vertex and color) at a certain index index must be between 0 and the atlas capacity - 1
local updateQuad | ( | local | quad, |
local | index | ||
) |
updates a Quad (texture, vertex and color) at a certain index index must be between 0 and the atlas capacity - 1
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
Quads that are going to be rendered.
|
protected |
Quads that are going to be rendered.
|
protected |
Quads that are going to be rendered.
|
protected |
Texture of the texture atlas.
|
protected |
Texture of the texture atlas.
|
protected |
Texture of the texture atlas.
|
protected |
quantity of quads that can be stored with the current texture atlas size
|
protected |
quantity of quads that can be stored with the current texture atlas size
|
protected |
quantity of quads that can be stored with the current texture atlas size
|
protected |
quantity of quads that are going to be drawn
|
protected |
quantity of quads that are going to be drawn
|
protected |
quantity of quads that are going to be drawn