cocos2d-x 3.0
- 首页 - 相关页面 - 模块 - 命名空间 - - 文件 -
Public 成员函数 - 图1 Public 成员函数 - 图2)
- 类列表 - 类索引 - 类继承关系 - 类成员

全部)) 命名空间) 文件) 函数) 变量) 类型定义) 枚举) 枚举值) 属性) 友元) 宏定义)))

Public 成员函数 | 静态 Public 成员函数 | Protected 成员函数 | Protected 属性 | 所有成员列表

SpriteFrameCache类 参考 Sprite Nodes

Singleton that handles the loading of the sprite frames. 更多…

#include

类 SpriteFrameCache 继承关系图:

Public 成员函数 - 图3 Ref

## Public 成员函数
virtual ~SpriteFrameCache ()
NA NA 更多…
bool init (void)
void addSpriteFramesWithFile (const std::string &plist)
Adds multiple Sprite Frames from a plist file. 更多…
void addSpriteFramesWithFile (const std::string &plist, const std::string &textureFileName)
Adds multiple Sprite Frames from a plist file. 更多…
void addSpriteFramesWithFile (const std::string &plist, Texture2D texture)
Adds multiple Sprite Frames from a plist file. 更多…
void addSpriteFrame (SpriteFrame frame, const std::string &frameName)
Adds an sprite frame with a given name. 更多…
void removeSpriteFrames ()
Purges the dictionary of loaded sprite frames. 更多…
void removeUnusedSpriteFrames ()
Removes unused sprite frames. 更多…
void removeSpriteFrameByName (const std::string &name)
Deletes an sprite frame from the sprite frame cache. 更多…
void removeSpriteFramesFromFile (const std::string &plist)
Removes multiple Sprite Frames from a plist file. 更多…
void removeSpriteFramesFromTexture (Texture2D texture)
Removes all Sprite Frames associated with the specified textures. 更多…
SpriteFrame getSpriteFrameByName (const std::string &name)
Returns an Sprite Frame that was previously added. 更多…
CC_DEPRECATED_ATTRIBUTE SpriteFrame spriteFrameByName (const std::string &name)
- Public 成员函数 继承自 Ref
void retain ()
保留所有权. 更多…
void release ()
立即释放所有权. 更多…
Ref autorelease ()
自动释放所有权在不久的将来. 更多…
unsigned int getReferenceCount () const
返回Ref对象当前的引用计数. 更多…
virtual ~Ref ()
NA NA 更多…
## 静态 Public 成员函数
static SpriteFrameCache getInstance (void)
Returns the shared instance of the Sprite Frame cache. 更多…
static CC_DEPRECATED_ATTRIBUTE SpriteFrameCache sharedSpriteFrameCache ()
static void destroyInstance ()
Destroys the cache. 更多…
static CC_DEPRECATED_ATTRIBUTE void purgeSharedSpriteFrameCache ()
## Protected 成员函数
SpriteFrameCache ()
- Protected 成员函数 继承自 Ref
Ref ()
构造函数 更多…
## Protected 属性
Map< std::string, SpriteFrame > _spriteFrames
ValueMap _spriteFramesAliases
std::set< std::string > _loadedFileNames
- Protected 属性 继承自 Ref
unsigned int _referenceCount
引用计数 更多…

详细描述

Singleton that handles the loading of the sprite frames.

It saves in a cache the sprite frames.

  • 自从
  • v0.9

构造及析构函数说明

SpriteFrameCache ( )

inlineprotected

virtual ~SpriteFrameCache ( )

virtual

NA NA

成员函数说明

void addSpriteFrame ( SpriteFrame * frame,
const std::string & frameName
)

Adds an sprite frame with a given name.

If the name already exists, then the contents of the old name will be replaced with the new one.

void addSpriteFramesWithFile ( const std::string & plist)

Adds multiple Sprite Frames from a plist file.

A texture will be loaded automatically. The texture name will composed by replacing the .plist suffix with .png If you want to use another texture, you should use the addSpriteFramesWithFile(const std::string& plist, const std::string& textureFileName) method. addSpriteFrames addSpriteFrames

void addSpriteFramesWithFile ( const std::string & plist,
const std::string & textureFileName
)

Adds multiple Sprite Frames from a plist file.

The texture will be associated with the created sprite frames.

  • 自从
  • v0.99.5 addSpriteFrames addSpriteFrames

void addSpriteFramesWithFile ( const std::string & plist,
Texture2D * texture
)

Adds multiple Sprite Frames from a plist file.

The texture will be associated with the created sprite frames. addSpriteFrames addSpriteFrames

static void destroyInstance ( )

static

Destroys the cache.

It releases all the Sprite Frames and the retained instance.

static SpriteFrameCache* getInstance ( void )

static

Returns the shared instance of the Sprite Frame cache.

SpriteFrame* getSpriteFrameByName ( const std::string & name)

Returns an Sprite Frame that was previously added.

If the name is not found it will return nil. You should retain the returned copy if you are going to use it. getSpriteFrame getSpriteFrame

bool init ( void )

static CC_DEPRECATED_ATTRIBUTE void purgeSharedSpriteFrameCache ( )

inlinestatic

void removeSpriteFrameByName ( const std::string & name)

Deletes an sprite frame from the sprite frame cache.

void removeSpriteFrames ( )

Purges the dictionary of loaded sprite frames.

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 removeSpriteFramesFromFile ( const std::string & plist)

Removes multiple Sprite Frames from a plist file.

Sprite Frames stored in this file will be removed. It is convenient to call this method when a specific texture needs to be removed.

  • 自从
  • v0.99.5

void removeSpriteFramesFromTexture ( Texture2D * texture)

Removes all Sprite Frames associated with the specified textures.

It is convenient to call this method when a specific texture needs to be removed.

  • 自从
  • v0.995.

void removeUnusedSpriteFrames ( )

Removes unused sprite frames.

Sprite Frames that have a retain count of 1 will be deleted. It is convenient to call this method after when starting a new Scene.

static CC_DEPRECATED_ATTRIBUTE SpriteFrameCache* sharedSpriteFrameCache ( )

inlinestatic

CC_DEPRECATED_ATTRIBUTE SpriteFrame* spriteFrameByName ( const std::string & name)

inline

类成员变量说明

std::set<std::string>* _loadedFileNames

protected

Map<std::string, SpriteFrame*> _spriteFrames

protected

ValueMap _spriteFramesAliases

protected


该类的文档由以下文件生成: