Blog Archives

Using accelerometer in cocos2d-x v3.2

Here is another one of the significant changes in version 3.2 if you are looking forward to use accelerometer in the future. In the init() method of your game Layer add the following code: Device::setAccelerometerEnabled(true); auto listener = EventListenerAcceleration::create(CC_CALLBACK_2(GameLayer::onAcceleration, this));
Posted in Tutorials Tagged with: ,

Join 1 other subscriber