2013-01-31 131 views

回答

0

是的,你可以看到類CCAccelerometer。並且在testcpp示例中,有一個AccelerometerTest

0

是的,但您應該手動啓用它。您還可以添加一個事件監聽器:

Device::setAccelerometerEnabled(true); 
Device::setAccelerometerInterval(1/30.0); 

auto accelerationListener = EventListenerAcceleration::create(CC_CALLBACK_2(GameplayLayer::onAcceleration, this)); 
_eventDispatcher->addEventListenerWithSceneGraphPriority(accelerationListener, this); 
2

編號Cocos2d-x還不支持陀螺儀。只有加速度計。