[ios5 cocos2d游戏开发实战] 笔记3-FileUtils, notificationCenter
2014-05-08 17:59
423 查看
FileUtils
//文件管理工具 FileUtils::getInstance() std::string getStringFromFile(const std::string& filename);//读取文件中的字符串 Data getDataFromFile(const std::string& filename);//获取文件数据 void setSearchPaths(const std::vector<std::string>& searchPaths);//设置搜索路径 void addSearchPath(const std::string & path);//增加搜索路径 bool isFileExist(const std::string& filePath);//判断文件是否存在
NotificationCenter
//发送事件 CCNotificationCenter::sharedNotificationCenter()->postNotification(CLICK_TEST_MSG, (CCObject*)data); //监听事件 void GameManager::initListener() { CCNotificationCenter::sharedNotificationCenter()->addObserver(this, callfuncO_selector(GameManager::onClickTest), CLICK_TEST_MSG, NULL); } //处理事件 void GameManager::onClickTest(CCObject* obj) { CCMessageBox("onClickTest", "Title"); //移除监听事件 CCNotificationCenter::sharedNotificationCenter()->removeObserver(this, CLICK_TEST_MSG); }
typedef void (CCObject::*SEL_SCHEDULE)(float);// 用来调update typedef void (CCObject::*SEL_CallFunc)();// 用来自定义无参回调 typedef void (CCObject::*SEL_CallFuncN)(CCNode*);// 带执行者回调 typedef void (CCObject::*SEL_CallFuncND)(CCNode*, void*); // 带一个自定参数的回调 typedef void (CCObject::*SEL_CallFuncO)(CCObject*); typedef void (CCObject::*SEL_MenuHandler)(CCObject*); typedef void (CCObject::*SEL_EventHandler)(CCEvent*); typedef int (CCObject::*SEL_Compare)(CCObject*);
相关文章推荐
- cocos2d-x v3.0的window平台搭建和编译成andriod程序
- cocos2dx 3.0学习笔记(一):Win32下-cocos2dx-3.0环境配置和创建项目
- Cocostudio 内存释放
- ocos2dx 3.0 windows 搭建
- Cocos2d-x处理双击事件的两种方法!
- cocos2d-x 中的使用CURL
- 初学cocos2dx 写了个2048 跟大家一起分享下
- Cocos2d-x项目过程中遇到的一些问题总结
- Cocos2d-x对精灵的优化
- Cocos2d-x for Windows Phone 用法总结
- 杨丰盛老师Cocos2D-X教学视频
- Cocos2dx之android版本的build.xml驯服记
- 【COCOS2DX-游戏开发之三十】抖动效果 CCShake
- [cocos2dx]如何将Android手机游戏移植到电视?
- cocos2d-x中缓存帧精灵创建
- cocos2dx 3.0rc如何创建项目
- cocos2dx生涯——添加ShareSDK时的各种注意事项
- cocos2d-x 音效中断问题
- cocostudio场景编辑器生成文件的调用方式
- CocoStudio sample讲解 SampleCollision骨骼动画与简单碰撞