clean up coding style and remove explicit temporary variable

This commit is contained in:
folecr 2013-08-09 11:39:52 -07:00
parent 063c730726
commit 2ebd400a75
1 changed files with 9 additions and 11 deletions

View File

@ -525,25 +525,23 @@ void android_main(struct android_app* state) {
AConfiguration* _currentconf = AConfiguration_new(); AConfiguration* _currentconf = AConfiguration_new();
AConfiguration_fromAssetManager(_currentconf, AConfiguration_fromAssetManager(_currentconf,
state->activity->assetManager); state->activity->assetManager);
static int32_t _orientation; static int32_t _orientation = AConfiguration_getOrientation(_currentconf);
_orientation = AConfiguration_getOrientation(_currentconf);
cocos2d::Director* pDirector = cocos2d::Director::getInstance();
if (ACONFIGURATION_ORIENTATION_LAND != _orientation) { if (ACONFIGURATION_ORIENTATION_LAND != _orientation) {
// ACONFIGURATION_ORIENTATION_ANY // ACONFIGURATION_ORIENTATION_ANY
// ACONFIGURATION_ORIENTATION_PORT // ACONFIGURATION_ORIENTATION_PORT
// ACONFIGURATION_ORIENTATION_SQUARE // ACONFIGURATION_ORIENTATION_SQUARE
pDirector->getAccelerometer()->update(event.acceleration.x, cocos2d::Director::getInstance()->getAccelerometer()->update(event.acceleration.x,
-event.acceleration.y, -event.acceleration.y,
event.acceleration.z, event.acceleration.z,
0); 0);
} else { } else {
// ACONFIGURATION_ORIENTATION_LAND // ACONFIGURATION_ORIENTATION_LAND
// swap x and y parameters // swap x and y parameters
pDirector->getAccelerometer()->update(-event.acceleration.y, cocos2d::Director::getInstance()->getAccelerometer()->update(-event.acceleration.y,
event.acceleration.x, event.acceleration.x,
event.acceleration.z, event.acceleration.z,
0); 0);
} }
} }
} }