zoukankan      html  css  js  c++  java
  • [ios5 cocos2d游戏开发实战] 笔记3-FileUtils, notificationCenter

    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*); 

     

  • 相关阅读:
    latex之插入伪代码 [转]
    BIBTeX制作参考文献 [转]
    latex 页眉设置 [转]
    python : list tuple set dictionary [转]
    ctags使用简介 [转]
    conda在指定目录下创建虚拟环境
    Ubuntu系统安装Anaconda3
    ModuleNotFoundError: No module named 'google' 问题解决方案
    PyCharm无法输入中文
    checkpoint文件
  • 原文地址:https://www.cnblogs.com/zengyou/p/3716736.html
Copyright © 2011-2022 走看看