restore AccelerometerTest

This commit is contained in:
Dhilan007 2013-09-19 19:05:52 +08:00
parent 302bdbbe8f
commit 2504b8e029
2 changed files with 3 additions and 3 deletions

View File

@ -598,7 +598,7 @@ void android_main(struct android_app* state) {
// ACONFIGURATION_ORIENTATION_PORT
// ACONFIGURATION_ORIENTATION_SQUARE
cocos2d::Acceleration acc;
acc.x = event.acceleration.x/10;
acc.x = -event.acceleration.x/10;
acc.y = -event.acceleration.y/10;
acc.z = event.acceleration.z/10;
acc.timestamp = 0;
@ -609,7 +609,7 @@ void android_main(struct android_app* state) {
// ACONFIGURATION_ORIENTATION_LAND
// swap x and y parameters
cocos2d::Acceleration acc;
acc.x = -event.acceleration.y/10;
acc.x = event.acceleration.y/10;
acc.y = -event.acceleration.x/10;
acc.z = event.acceleration.z/10;
acc.timestamp = 0;

View File

@ -69,7 +69,7 @@ void AccelerometerTest::onAcceleration(Acceleration* acc, Event* event)
auto ptNow = _ball->getPosition();
auto ptTemp = pDir->convertToUI(ptNow);
ptTemp.x -= acc->x * 9.81f;
ptTemp.x += acc->x * 9.81f;
ptTemp.y -= acc->y * 9.81f;
auto ptNext = pDir->convertToGL(ptTemp);