//文件管理工具 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);//判斷文件是否存在
//發送事件 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*);