cocos2d-X 节点(CCAnimationCache.h)API

本文详细介绍了cocos2d-X中AnimationCache类的功能及用法,包括动画的添加、获取与移除等操作,并提供了版本1与版本2的解析方法,帮助开发者更好地管理和使用游戏动画。

本文来自http://blog.youkuaiyun.com/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__


下载前可以先看下教程 https://pan.quark.cn/s/a4b39357ea24 在网页构建过程中,表单(Form)扮演着用户与网站之间沟通的关键角色,其主要功能在于汇集用户的各类输入信息。 JavaScript作为网页开发的核心技术,提供了多样化的API和函数来操作表单组件,诸如input和select等元素。 本专题将详细研究如何借助原生JavaScript对form表单进行视觉优化,并对input输入框与select下拉框进行功能增强。 一、表单基础1. 表单组件:在HTML语言中,<form>标签用于构建一个表单,该标签内部可以容纳多种表单组件,包括<input>(输入框)、<select>(下拉框)、<textarea>(多行文本输入区域)等。 2. 表单参数:诸如action(表单提交的地址)、method(表单提交的协议,为GET或POST)等属性,它们决定了表单的行为特性。 3. 表单行为:诸如onsubmit(表单提交时触发的动作)、onchange(表单元素值变更时触发的动作)等事件,能够通过JavaScript进行响应式处理。 二、input元素视觉优化1. CSS定制:通过设定input元素的CSS属性,例如border(边框)、background-color(背景色)、padding(内边距)、font-size(字体大小)等,能够调整其视觉表现。 2. placeholder特性:提供预填的提示文字,以帮助用户明确输入框的预期用途。 3. 图标集成:借助:before和:after伪元素或者额外的HTML组件结合CSS定位技术,可以在输入框中嵌入图标,从而增强视觉吸引力。 三、select下拉框视觉优化1. 复选功能:通过设置multiple属性...
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值