mirror of https://github.com/axmolengine/axmol.git
Merge pull request #3710 from Dhilan007/develop
restore AccelerometerTest
This commit is contained in:
commit
dadf6b3d0b
|
@ -598,7 +598,7 @@ void android_main(struct android_app* state) {
|
||||||
// ACONFIGURATION_ORIENTATION_PORT
|
// ACONFIGURATION_ORIENTATION_PORT
|
||||||
// ACONFIGURATION_ORIENTATION_SQUARE
|
// ACONFIGURATION_ORIENTATION_SQUARE
|
||||||
cocos2d::Acceleration acc;
|
cocos2d::Acceleration acc;
|
||||||
acc.x = event.acceleration.x/10;
|
acc.x = -event.acceleration.x/10;
|
||||||
acc.y = -event.acceleration.y/10;
|
acc.y = -event.acceleration.y/10;
|
||||||
acc.z = event.acceleration.z/10;
|
acc.z = event.acceleration.z/10;
|
||||||
acc.timestamp = 0;
|
acc.timestamp = 0;
|
||||||
|
@ -609,7 +609,7 @@ void android_main(struct android_app* state) {
|
||||||
// ACONFIGURATION_ORIENTATION_LAND
|
// ACONFIGURATION_ORIENTATION_LAND
|
||||||
// swap x and y parameters
|
// swap x and y parameters
|
||||||
cocos2d::Acceleration acc;
|
cocos2d::Acceleration acc;
|
||||||
acc.x = -event.acceleration.y/10;
|
acc.x = event.acceleration.y/10;
|
||||||
acc.y = -event.acceleration.x/10;
|
acc.y = -event.acceleration.x/10;
|
||||||
acc.z = event.acceleration.z/10;
|
acc.z = event.acceleration.z/10;
|
||||||
acc.timestamp = 0;
|
acc.timestamp = 0;
|
||||||
|
|
|
@ -69,7 +69,7 @@ void AccelerometerTest::onAcceleration(Acceleration* acc, Event* event)
|
||||||
auto ptNow = _ball->getPosition();
|
auto ptNow = _ball->getPosition();
|
||||||
auto ptTemp = pDir->convertToUI(ptNow);
|
auto ptTemp = pDir->convertToUI(ptNow);
|
||||||
|
|
||||||
ptTemp.x -= acc->x * 9.81f;
|
ptTemp.x += acc->x * 9.81f;
|
||||||
ptTemp.y -= acc->y * 9.81f;
|
ptTemp.y -= acc->y * 9.81f;
|
||||||
|
|
||||||
auto ptNext = pDir->convertToGL(ptTemp);
|
auto ptNext = pDir->convertToGL(ptTemp);
|
||||||
|
|
Loading…
Reference in New Issue