cocos2d-x
2.2.3-gd2.113-rev1ec524e
|
Singleton that handles the loading of textures Once the texture is loaded, the next time it will return a reference of the previously loaded texture reducing GPU & CPU memory. More...
#include <CCTextureCache.h>
Public Member Functions | |
CCTextureCache () | |
ctor NA More... | |
virtual | ~CCTextureCache () |
NA NA. More... | |
const char * | description (void) |
NA NA. More... | |
CCDictionary * | snapshotTextures () |
NA. More... | |
void | addImageAsync (const char *path, CCObject *target, SEL_CallFuncO selector) |
CCTexture2D * | addUIImage (CCImage *image, const char *key) |
Returns a Texture2D object given an UIImage image If the image was not previously loaded, it will create a new CCTexture2D object and it will return it. More... | |
CCTexture2D * | textureForKey (const char *key) |
Returns an already created texture. More... | |
bool | reloadTexture (const char *fileName) |
Reload texture from the image file If the file image hasn't loaded before, load it. More... | |
void | removeAllTextures () |
Purges the dictionary of loaded textures. More... | |
void | removeUnusedTextures () |
Removes unused textures Textures that have a retain count of 1 will be deleted It is convenient to call this method after when starting a new Scene. More... | |
void | removeTexture (CCTexture2D *texture) |
Deletes a texture from the cache given a texture. More... | |
void | removeTextureForKey (const char *textureKeyName) |
Deletes a texture from the cache given a its key name. More... | |
void | dumpCachedTextureInfo () |
Output to CCLOG the current contents of this CCTextureCache This will attempt to calculate the size of each texture, and the total texture memory in use. More... | |
CCTexture2D * | addPVRImage (const char *filename) |
Returns a Texture2D object given an PVR filename If the file image was not previously loaded, it will create a new CCTexture2D object and it will return it. More... | |
CCTexture2D * | addETCImage (const char *filename) |
Returns a Texture2D object given an ETC filename If the file image was not previously loaded, it will create a new CCTexture2D object and it will return it. More... | |
CCTexture2D * | addImage (const char *fileimage, bool) |
Returns a Texture2D object given an file image If the file image was not previously loaded, it will create a new CCTexture2D object and it will return it. More... | |
![]() | |
CCObject (void) | |
virtual | ~CCObject (void) |
NA. More... | |
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) |
CCObject (const CCObject &) | |
CCObject & | operator= (const CCObject &) |
virtual void | encodeWithCoder (DS_Dictionary *) |
virtual bool | canEncode () |
CCObjectType | getObjType () const |
virtual int | getTag () const |
virtual void | setTag (int nTag) |
void | setObjType (CCObjectType) |
![]() | |
virtual CCObject * | copyWithZone (CCZone *pZone) |
Static Public Member Functions | |
static CCTextureCache * | sharedTextureCache () |
Returns the shared instance of the cache getInstance. More... | |
static void | purgeSharedTextureCache () |
purges the cache. More... | |
static void | reloadAllTextures () |
Reload all textures It's only useful when the value of CC_ENABLE_CACHE_TEXTURE_DATA is 1. More... | |
![]() | |
static CCObject * | createWithCoder (DS_Dictionary *) |
Protected Attributes | |
CCDictionary * | m_pTextures |
![]() | |
unsigned int | m_uReference |
unsigned int | m_uAutoReleaseCount |
int | m_nTag |
int | m_eObjType |
unsigned int | m_uObjectIdxInArray |
Additional Inherited Members | |
![]() | |
unsigned int | m_uID |
int | m_nLuaID |
Singleton that handles the loading of textures Once the texture is loaded, the next time it will return a reference of the previously loaded texture reducing GPU & CPU memory.
CCTextureCache | ( | ) |
ctor NA
|
virtual |
NA NA.
CCTexture2D * addETCImage | ( | const char * | filename | ) |
Returns a Texture2D object given an ETC filename If the file image was not previously loaded, it will create a new CCTexture2D object and it will return it.
Otherwise it will return a reference of a previously loaded image NA
CCTexture2D * addImage | ( | const char * | fileimage, |
bool | |||
) |
Returns a Texture2D object given an file image If the file image was not previously loaded, it will create a new CCTexture2D object and it will return it.
It will use the filename as a key. Otherwise it will return a reference of a previously loaded image. Supported image extensions: .png, .bmp, .tiff, .jpeg, .pvr, .gif
void addImageAsync | ( | const char * | path, |
CCObject * | target, | ||
SEL_CallFuncO | selector | ||
) |
CCTexture2D * addPVRImage | ( | const char * | filename | ) |
Returns a Texture2D object given an PVR filename If the file image was not previously loaded, it will create a new CCTexture2D object and it will return it.
Otherwise it will return a reference of a previously loaded image
CCTexture2D * addUIImage | ( | CCImage * | image, |
const char * | key | ||
) |
Returns a Texture2D object given an UIImage image If the image was not previously loaded, it will create a new CCTexture2D object and it will return it.
Otherwise it will return a reference of a previously loaded image The "key" parameter will be used as the "key" for the cache. If "key" is nil, then a new texture will be created each time.
const char * description | ( | void | ) |
NA NA.
void dumpCachedTextureInfo | ( | ) |
Output to CCLOG the current contents of this CCTextureCache This will attempt to calculate the size of each texture, and the total texture memory in use.
|
static |
purges the cache.
It releases the retained instance.
|
static |
Reload all textures It's only useful when the value of CC_ENABLE_CACHE_TEXTURE_DATA is 1.
bool reloadTexture | ( | const char * | fileName | ) |
Reload texture from the image file If the file image hasn't loaded before, load it.
Otherwise the texture will be reloaded from the file image. The "filenName" parameter is the related/absolute path of the file image. Return true if the reloading is succeed, otherwise return false.
void removeAllTextures | ( | ) |
Purges the dictionary of loaded textures.
Call this method if you receive the "Memory Warning" In the short term: it will free some resources preventing your app from being killed In the medium term: it will allocate more resources In the long term: it will be the same
void removeTexture | ( | CCTexture2D * | texture | ) |
Deletes a texture from the cache given a texture.
void removeTextureForKey | ( | const char * | textureKeyName | ) |
Deletes a texture from the cache given a its key name.
void removeUnusedTextures | ( | ) |
Removes unused textures Textures that have a retain count of 1 will be deleted It is convenient to call this method after when starting a new Scene.
|
static |
Returns the shared instance of the cache getInstance.
CCDictionary * snapshotTextures | ( | ) |
NA.
CCTexture2D * textureForKey | ( | const char * | key | ) |
Returns an already created texture.
Returns nil if the texture doesn't exist.
|
protected |