Reputation: 21
Does Cocos2d-x gives support for using gyroscope? And if it isn't, then how can i use it?
Upvotes: 0
Views: 1165
Reputation: 65
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);
Upvotes: 0
Reputation: 1
Yes, you can see the class CCAccelerometer. and in the testcpp sample, there is a AccelerometerTest
Upvotes: 0