본문 바로가기
알면 좋은 맥, 아이폰 정보/아이폰

cocos2d-x 터치 이벤트

by snapshot 2013. 1. 24.

Header


    virtual void registerWithTouchDispatcher(void);

    void ccTouchesBegan(CCSet *pTouches, CCEvent *pEvent);

    void ccTouchesMoved(CCSet *pTouches, CCEvent *pEvent);

    

    void ccTouchesEnded(CCSet *pTouches, CCEvent *pEvent);




main


init에다가는

    this->setTouchEnabled(true); //추가



// 터치


void HelloWorld::registerWithTouchDispatcher(void)

{

    CCDirector::sharedDirector()->getTouchDispatcher()->addStandardDelegate(this, 0);

}



void HelloWorld::ccTouchesBegan(CCSet *pTouches, CCEvent *pEvent)

{

    CCLog("터치");

    

    

}


void HelloWorld::ccTouchesMoved(CCSet *pTouches, CCEvent *pEvent)

{


}


void HelloWorld::ccTouchesEnded(CCSet *pTouches, CCEvent *pEvent)

{



}


댓글