// 在init这个函数当中做一些初始化的事情 bool HelloWorld::init() { ////////////////////////////// // 先构造父级对象 if ( !CCLayer::init() ) { return false; } CCSize size=CCDirector::sharedDirector()->getWinSize(); setTouchEnabled(true); return true; } void HelloWorld::ccTouchesBegan(CCSet *pTouch,CCEvent *pEvent) { CCLOG("began"); CCSetIterator iter=pTouch->begin(); for(;iter!=pTouch->end();iter++) { CCTouch *touch=(CCTouch*)(*iter); CCPoint point=touch->getLocation(); CCSprite *icon=CCSprite::create("s_1.png"); icon->setPosition(point); addChild(icon); } /* CCTouch *touch=(CCTouch*)pTouch->anyObject(); */ }