Does Cocos2d-x gives support for using gyroscope? And if it isn't, then how can i use it?
Asked
Active
Viewed 1,151 times
3 Answers
0
Yes, you can see the class CCAccelerometer. and in the testcpp sample, there is a AccelerometerTest
0
Yes, but you should enable it manually. You also can add a event listener that way :
Device::setAccelerometerEnabled(true);
Device::setAccelerometerInterval(1 / 30.0);
auto accelerationListener = EventListenerAcceleration::create(CC_CALLBACK_2(GameplayLayer::onAcceleration, this));
_eventDispatcher->addEventListenerWithSceneGraphPriority(accelerationListener, this);

AbsZero
- 65
- 1
- 6