CCComponentContainer,CCComponent解析
来源:互联网 发布:微商城与淘宝的区别 编辑:程序博客网 时间:2024/05/22 12:23
CCComponent:
源码:
enum { kComponentOnEnter, kComponentOnExit, kComponentOnUpdate};/// 组件class CC_DLL Component : public Ref{CC_CONSTRUCTOR_ACCESS: /** * @js ctor */ Component(void);public: /** * @js NA * @lua NA */ virtual ~Component(void); virtual bool init();/// 进入的时候调用 virtual void onEnter();/// 退出的时候调用 virtual void onExit();/// 更新 virtual void update(float delta);/// 是否序列化 virtual bool serialize(void* r);/// 是否可用 virtual bool isEnabled() const;/// 设置状态 virtual void setEnabled(bool b);/// 创建一个组件 static Component* create(void); /// 得到名字 const std::string& getName() const;/// 设置名字 void setName(const std::string& name); /// 设置拥有者 void setOwner(Node *pOwner);/// 得到拥有者 Node* getOwner() const;protected: Node *_owner; std::string _name; bool _enabled; #if CC_ENABLE_SCRIPT_BINDING ccScriptType _scriptType; ///< type of script binding, lua or javascript#endif};
CCComponentContainer:
源码:
/// 组件容器class CC_DLL ComponentContainer{protected: /** * @js ctor */ /// 构造 ComponentContainer(Node *pNode); public: /** * @js NA * @lua NA */ /// 析构 virtual ~ComponentContainer(void);/** * @js getComponent */ /// 得到组件virtual Component* get(const std::string& name) const;/// 添加组件 virtual bool add(Component *com);/// 移除组件 virtual bool remove(const std::string& name);/// 移除组件 virtual bool remove(Component *com);/// 移除所有组件 virtual void removeAll();/// 访问,更新所有的组件 virtual void visit(float delta);public:/// 是否是空的 bool isEmpty() const; private:/// 分配,新建的一个存储组件的Map void alloc(void); private: Map<std::string, Component*>* _components; Node *_owner; friend class Node;};NS_CC_END
0 0
- CCComponentContainer,CCComponent解析
- component/CCComponentContainer(接口容器)
- component/CCComponent (node接口函数 提供了serialize setEnabled setOwner接口 成员数据m_pOwner m_strName m_bEnabled
- 解析
- 解析
- 解析
- 解析
- 解析
- 解析
- 解析
- 解析
- 解析
- 解析[ ]
- 解析
- ffmpeg解析-----解析文件格式
- Xen解析 netfilter解析
- JSON解析,XML解析
- 硬解析 软解析
- redis实战基础篇:redis的5种数据类型的基本操作
- interactive/non-interactive, login/non-login shells
- 1007. Maximum Subsequence Sum (25)
- 【DirectX 2D游戏开发基础】DirectX的应用实例
- CodeForces 7A - Kalevitch and Chess
- CCComponentContainer,CCComponent解析
- 关于Manifest
- mysql的交集与差集
- 验证二叉查找树
- VS下生成与配置静态库与动态库(一)
- 设计模式---策略模式
- 不跟进,便淘汰
- Dui缓慢飘出窗体的实现
- 二分查找的两种实现方法