- void OnAcceleration(cocos2d::Acceleration *acc,cocos2d::Event *event);
.cpp
- Device::setAccelerometerEnabled(true);
auto listener2 = EventListenerAcceleration::create(CC_CALLBACK_2(HelloWorld::onAcceleration,this));
_eventDispatcher->addEventListenerWithSceneGraphPriority(listener2,this);
void HelloWorld::onAcceleration(cocos2d::Acceleration *acc,cocos2d::Event *event)
{
CCLOG("%f",acc->z);
}
Inga kommentarer:
Skicka en kommentar