[iOS5 cocos2d Game Development Combat] notes 3-fileutils, Notificationcenter

Source: Internet
Author: User

FileUtils
//File Management Toolsfileutils::getinstance () std::stringGetstringfromfile (ConstSTD::string& filename);//reading a string in a fileData Getdatafromfile (ConstSTD::string& filename);//Get File DatavoidSetsearchpaths (ConstSTD::VECTOR<STD::string>& searchpaths);//set the search pathvoidAddsearchpath (ConstSTD::string& path);//Add search PathBOOLIsfileexist (ConstSTD::string& FilePath);//determine if a file exists

Notificationcenter

//Send EventCcnotificationcenter::sharednotificationcenter ()->postnotification (click_test_msg, (CCObject*) data);//Monitoring EventsvoidGamemanager::initlistener () {ccnotificationcenter::sharednotificationcenter ()->addobserver ( This, Callfunco_selector (gamemanager::onclicktest), click_test_msg, NULL);}//Handling EventsvoidGamemanager::onclicktest (ccobject*obj) {Ccmessagebox ("onclicktest","Title"); //To remove a listener eventCcnotificationcenter::sharednotificationcenter ()->removeobserver ( This, click_test_msg);}

typedefvoid(ccobject::* sel_schedule) (float);//used to tune the updatetypedefvoid(ccobject::* sel_callfunc) ();//To define a parameterless callback with thetypedefvoid(ccobject::* SEL_CALLFUNCN) (ccnode*);//with performer Callbacktypedefvoid(ccobject::* sel_callfuncnd) (Ccnode*,void*);//callback with a custom parametertypedefvoid(ccobject::* Sel_callfunco) (ccobject*); typedefvoid(ccobject::* Sel_menuhandler) (ccobject*); typedefvoid(ccobject::* Sel_eventhandler) (ccevent*); typedefint(ccobject::* sel_compare) (ccobject*);

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.