textureCache 类型

模块: cc 父模块: cc

cc.textureCache is a singleton object, it's the global cache for cc.Texture2D

索引

方法

Details

方法

description

Description

meta description
返回 String
定义于 cocos2d/core/textures/CCTextureCache.js:44
getTextureForKey

Returns an already created texture. Returns null if the texture doesn't exist.

meta description
返回 Texture2D | Null
定义于 cocos2d/core/textures/CCTextureCache.js:53
参数列表
示例
------------------
var key = cc.textureCache.getTextureForKey("hello.png");
getTextureColors
meta description
返回 Array
定义于 cocos2d/core/textures/CCTextureCache.js:83
参数列表
  • texture HTMLImageElement
示例
---------------
var cacheTextureForColor = cc.textureCache.getTextureColors(texture);
getAllTextures

获取所有贴图

meta description
返回 Texture2D[]
定义于 cocos2d/core/textures/CCTextureCache.js:104
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

meta description
定义于 cocos2d/core/textures/CCTextureCache.js:119
示例
--------
cc.textureCache.removeAllTextures();
removeTexture

Deletes a texture from the cache given a texture.

meta description
定义于 cocos2d/core/textures/CCTextureCache.js:137
参数列表
  • texture HTMLImageElement
示例
-----
cc.textureCache.removeTexture(texture);
removeTextureForKey

Deletes a texture from the cache given a its key name.

meta description
定义于 cocos2d/core/textures/CCTextureCache.js:156
参数列表
示例
------
cc.textureCache.removeTexture("hello.png");
addImage

Returns a Texture2D object given an file image
If the file image was not previously loaded, it will create a new Texture2D 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, .jpg, .gif

meta description
返回 Texture2D
定义于 cocos2d/core/textures/CCTextureCache.js:178
参数列表
示例
----
cc.textureCache.addImage("hello.png");
cacheImage

Cache the image data.

meta description
定义于 cocos2d/core/textures/CCTextureCache.js:229
参数列表
  • path String
  • texture HTMLImageElement | HTMLCanvasElement

results matching ""

    No results matching ""