cocos2dx layer理解
2015-08-28 03:53
375 查看
对Layer的理解
/////cocos2d-x-3.0alpha0/extensions/CocoStudio/GUI/System // 获取 UIInputManager,添加/移除 widget ,设置 UILayer 的可见 性 #ifndef __UILAYER_H__ #define __UILAYER_H__ #include "cocos2d.h" #include "ExtensionMacros.h" #include "../BaseClasses/UIRootWidget.h" #include "../System/UIInputManager.h" NS_CC_EXT_BEGIN class UILayer : public Layer { public: /** * Default constructor */ UILayer(); /** * Default destructor */ virtual ~UILayer(); /** * Allocates and initializes a widget. */ static UILayer *create(void); //initializes state of uilayer. //初始化 uilayer 的状态 virtual bool init(); virtual void onEnter(); virtual void onExit(); virtual void onEnterTransitionDidFinish(); virtual bool onTouchBegan(Touch *pTouch, Event *pEvent); virtual void onTouchMoved(Touch *pTouch, Event *pEvent); virtual void onTouchEnded(Touch *pTouch, Event *pEvent); virtual void onTouchCancelled(Touch *pTouch, Event *pEvent); /** * Add a widget to UILayer, for drawing. //为绘制添加一个 eidget 到 UILayer * * @param widget. */ void addWidget(UIWidget* widget); /** * Remove a widget from UILayer. * * @param widget. * * @param cleanup true 所有 children widgets 运行的 所有 action 都将 删除, false otherwise. */ void removeWidget(UIWidget* widget); /** * Sets whether the UILayer is visible 可见 * * 默认值是 true ,默认可见 * * @param visible true if the UILayer is visible, false if the UILayer is hidden. */ virtual void setVisible(bool visible); /** * Finds a widget whose tag is equal tag param from widget tree. //从 widget 树上查找 tag 等于输入参数的 widget * * @param tag. */ UIWidget* getWidgetByTag(int tag); /** * Seek a widget whose name is equal name param from widget tree. //从 widget 树上查找 name 等于输入参数的 widget * * @param name. */ UIWidget* getWidgetByName(const char* name); /** * Gets UIInputManager. * * UIInputManager 管理 UILayer 的触摸. * * @return UIInputManager. */ UIInputManager* getInputManager(); /** * Remove and clean up all of UILayer's widget. //移除并清理所有的 UILayer's widget. */ virtual void clear(); /** * Gets root widget of UILayer. * * @return UIRootWidget, "UIRootWidget" is the root widget of UILayer. */ UIRootWidget* getRootWidget(); protected: UIRootWidget* _rootWidget; UIInputManager* _inputManager; }; NS_CC_EXT_END #endif /* defined(__UILAYER_H__) */
相关文章推荐
- cocos2dx 内存学习一
- COCOS2D-X项目在XCODE没有IOS Simulator,无法仿真的解决办法
- Cocos2dx 3.4 BabeLua 3.0.1.0 Windows下lua环境配置
- Cocos2dx学习笔记7:精灵(Sprite)
- Cocos2dx学习笔记6:层(Layer)
- Cocos2dx学习笔记5:场景(Scene)
- cocos2d-x Lua使用pluginx中得IOSIAP遇到的问题
- 关于cocos2dx的textfield事件响应
- cocos lua学习笔记
- cocos2d-x学习笔记(四)粒子系统使用中多次调用时GL calls不断增加的解决办法
- Cocos2d-x -- 如何让背景从上到下滚动
- cocos2d-x 颜色混合
- cocos2dx 简易摇杆demo
- COCOS2D-X编译成安卓APP添加友盟统计和百度广告的代码示例
- cocos2d-x在安卓平台编译常见的2个问题及解决办法
- Cocos2d-x/Cocos2d-js编译64位so库中遇到的问题
- 解决cocos2d-x 安卓锁屏再解锁,OPenGL报错;后台转前台异常问题解决办法 (续)
- cocos2d里面如何实现MVC
- 解决cocos2d-x 安卓锁屏再解锁,OPenGL报错;后台转前台异常问题解决办法
- cocos2d-x中关于touch事件的响应