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 () | |
virtual | ~CCTextureCache () |
const char * | description (void) |
CCDictionary * | snapshotTextures () |
local | snapshotTextures () |
CCTexture2D * | addImage (const char *fileimage) |
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... | |
var | addImage ( var fileimage) |
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... | |
local | addImage ( local fileimage) |
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... | |
void | addImageAsync (const char *path, CCObject *target, SEL_CallFuncO selector) |
local | addImageAsync ( local path, local target, local 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... | |
var | addUIImage ( var image, var 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... | |
local | addUIImage ( local image, local 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... | |
local | textureForKey ( local 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... | |
var | removeTextureForKey ( var textureKeyName) |
Deletes a texture from the cache given a its key name. More... | |
local | removeTextureForKey ( local 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... | |
var | addPVRImage ( var 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... | |
local | addPVRImage ( local 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... | |
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 CCTextureCache * | sharedTextureCache () |
Returns the shared instance of the cache. More... | |
var | getInstance () |
Returns the shared instance of the cache. More... | |
local | sharedTextureCache () |
Returns the shared instance of the cache. 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... | |
var | reloadAllTextures () |
Reload all textures It's only useful when the value of CC_ENABLE_CACHE_TEXTURE_DATA is 1 More... | |
local | reloadAllTextures () |
Reload all textures It's only useful when the value of CC_ENABLE_CACHE_TEXTURE_DATA is 1 More... | |
Protected Attributes | |
CCDictionary * | m_pTextures |
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 |
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 | ( | ) |
var ctor | ( | ) |
|
virtual |
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
var addETCImage | ( | var | 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
CCTexture2D* addImage | ( | const char * | fileimage) |
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
var addImage | ( | var | fileimage) |
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
local addImage | ( | local | fileimage) |
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 | ||
) |
var addImageAsync | ( | var | path, |
var | target, | ||
var | selector | ||
) |
local addImageAsync | ( | local | path, |
local | target, | ||
local | 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
var addPVRImage | ( | var | 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
local addPVRImage | ( | local | 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.
var addUIImage | ( | var | image, |
var | 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.
local addUIImage | ( | local | image, |
local | 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 | ) |
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.
var 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.
local 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 |
purges the cache.
It releases the retained instance.
|
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
|
static |
Reload all textures
It's only useful when the value of CC_ENABLE_CACHE_TEXTURE_DATA is 1
|
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.
var reloadTexture | ( | var | 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.
local reloadTexture | ( | local | 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
var 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
local 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.
var removeTexture | ( | var | texture) |
Deletes a texture from the cache given a texture.
local removeTexture | ( | local | 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.
var removeTextureForKey | ( | var | textureKeyName) |
Deletes a texture from the cache given a its key name.
local removeTextureForKey | ( | local | 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.
var 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.
local 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.
|
static |
Returns the shared instance of the cache.
|
static |
Returns the shared instance of the cache.
CCDictionary* snapshotTextures | ( | ) |
local snapshotTextures | ( | ) |
CCTexture2D* textureForKey | ( | const char * | key) |
Returns an already created texture.
Returns nil if the texture doesn't exist.
var textureForKey | ( | var | key) |
Returns an already created texture.
Returns nil if the texture doesn't exist.
local textureForKey | ( | local | key) |
Returns an already created texture.
Returns nil if the texture doesn't exist.
|
protected |
|
protected |
|
protected |