标签:
bool HelloWorld::init()
{
if ( !Layer::init() )
{
return false;
}
Device::setAccelerometerEnabled(true);
Director::getInstance()->getEventDispatcher()->addEventListenerWithSceneGraphPriority(EventListenerAcceleration::create([](Acceleration *a,Event *e){
log("x:%g,y:%g,z:%g",a->x,a->y,a->z);
}),this);
return true;
}
标签:
原文地址:http://www.cnblogs.com/daochong/p/5229368.html