- I .h filen:
void onTouchesBegan(const std::vector<cocos2d::Touch *> &touches,cocos2d::Event * event);
void onTouchesMoved(const std::vector<cocos2d::Touch *> &touches,cocos2d::Event * event);
void onTouchesEnded(const std::vector<cocos2d::Touch *> &touches,cocos2d::Event * event); - I cpp filen:
auto listener = EventListenerTouchAllAtOnce::create();
listener->onTouchesBegan=CC_CALLBACK_2(HelloWorld::onTouchesBegan,this);
listener->onTouchesMoved=CC_CALLBACK_2(HelloWorld::onTouchesMoved,this);
listener->onTouchesEnded=CC_CALLBACK_2(HelloWorld::onTouchesEnded,this);
_eventDispatcher->addEventListenerWithSceneGraphPriority(listener,this);
void HelloWorld::onTouchesBegan(const std::vector<cocos2d::Touch *> &touches,cocos2d::Event * event)
{
CCLOG("MultiTouchesBegan x = %f, y = %f",touch->getLocation().x,touch->getLocation().y);
}
void HelloWorld::onTouchesMoved(const std::vector<cocos2d::Touch *> &touches,cocos2d::Event * event)
{
CCLOG("MultiTouchesMoved");
}
void HelloWorld::onTouchesEnded(const std::vector<cocos2d::Touch *> &touches,cocos2d::Event * event)
{
CCLOG("MultiTouchesEnded");
}
onsdag 2 juli 2014
Multi tryck på skärmen.
Prenumerera på:
Kommentarer till inlägget (Atom)
Inga kommentarer:
Skicka en kommentar