0

Does Cocos2d-x gives support for using gyroscope? And if it isn't, then how can i use it?

Patrick Hofman
  • 153,850
  • 22
  • 249
  • 325

3 Answers3

2

No. Cocos2d-x doesn't support gyroscope yet. Only accelerometer.

Serhiy
  • 332
  • 6
  • 13
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