cocos2d-X 节点(CCAnimationCache.h)API
2013-11-07 18:32
302 查看
本文来自http://blog.csdn.net/runaying ,引用必须注明出处!
cocos2d-X 节点(CCAnimationCache.h)API
温馨提醒:为了大家能更好学习,强烈推荐大家看看本人的这篇博客 Cocos2d-X权威指南笔记///cocos2d-x-3.0alpha0/cocos2dx/sprite_nodes #ifndef __CC_ANIMATION_CACHE_H__ #define __CC_ANIMATION_CACHE_H__ #include "cocoa/CCObject.h" #include "cocoa/CCDictionary.h" #include <string> NS_CC_BEGIN class Animation; /** * @addtogroup sprite_nodes * @{ */ /** 管理 Animations 的 Singleton(单例). 他把 animations 存储到 擦车里. 如果你希望在 cache 里面存储你的 animations(cocos2d 把所有的动画统称为 animatiosns),你可以使用这个类 Before v0.99.5, 推荐使用这个方法存储 Sprite. Since v0.99.5, 你应该使用这个类代替 @since v0.99.5 */ class CC_DLL AnimationCache : public Object { public: /** * @js ctor */ AnimationCache(); /** * @js NA * @lua NA */ ~AnimationCache(); /** Returns 动画缓存的共享实例e */ static AnimationCache* getInstance(); /** 清除缓存。它释放所有动画对象和共享实例。 */ static void destroyInstance(); /** @过时不再需要建议使用新的 API 可以使用 getInstance() 代替 */ CC_DEPRECATED_ATTRIBUTE static AnimationCache* sharedAnimationCache() { return AnimationCache::getInstance(); } /** @过时不再需要建议使用新的 API 可以使用 destroyInstance() 代替 */ CC_DEPRECATED_ATTRIBUTE static void purgeSharedAnimationCache() { return AnimationCache::destroyInstance(); } bool init(void); /** 使用 name 添加一个 Animation */ void addAnimation(Animation *animation, const char * name); /** 从 cache里面删除 一个 Animation */ void removeAnimation(const char* name); /** @过时不再需要建议使用新的 API 可以使用 removeAnimation() 代替 * @js NA * @lua NA */ CC_DEPRECATED_ATTRIBUTE void removeAnimationByName(const char* name){ removeAnimation(name);} /** Returns 先前添加的 Animation 如果没有找到 name 对应的 animation 返回 nil 如果你要使用他你应该 retain(保留)返回的副本 */ Animation* getAnimation(const char* name); /** @过时不再需要建议使用新的 API 可以使用 getAnimation() 代替 * @js NA * @lua NA */ CC_DEPRECATED_ATTRIBUTE Animation* animationByName(const char* name){ return getAnimation(name); } /** 使用 NSDictionary 添加一个 animaton 请确保先前的 frames 在 SpriteFrameCache 里面加载成功 @since v1.1 */ void addAnimationsWithDictionary(Dictionary* dictionary); /** 从 plist 文件添加 animation 请确保先前的 frames 在 SpriteFrameCache 里面加载成功 @since v1.1 * @js addAnimations * @lua addAnimations */ void addAnimationsWithFile(const char* plist); private: void parseVersion1(Dictionary* animations); void parseVersion2(Dictionary* animations); private: Dictionary* _animations; static AnimationCache* s_pSharedAnimationCache; }; // end of sprite_nodes group /// @} NS_CC_END #endif // __CC_ANIMATION_CACHE_H__
相关文章推荐
- cocos2d-x节点(CCShaderCache.h)API
- cocos2d-x节点(CCTextureCache.h)API
- cocos2d-X 节点(CCSpriteFrameCache.h)API
- cocos2d-x节点(CCAnimation.h)API
- cocos2d-x节点(ccGLStateCache.h)API
- cocos2d-x节点(CCPlatformMacros.h)API
- cocos2d-x节点(CCParticleSystem.h)API
- cocos2d-x节点(CCActionInterval.h)API
- cocos2d-x节点(CCEventListenerTouch.h)API
- cocos2d-x节点(CCObject.h)API
- cocos2d-x节点(CCActionCamera.h)API
- COcos2d-X 节点(CCScheduler.h)API
- cocos2d-X 节点(SpriteBatchNode.h.)API
- cocos2d-X 节点(CCTMXObjectGroup.h)API
- cocos2d-X 节点(CCActionNode.h)API
- cocos2d-x节点(b2Joint.h)API
- cocos2d-x节点(b2TimeOfImpact.h)API
- cocos2d-x节点(CCGLProgram.h)API
- cocos2d-x节点(CCParticleSystemQuad.h)API
- cocos2d-x节点(CCTransition.h)API