Permalink
Browse files

Merge pull request #10436 from Dhilan007/v4-Accelerometer-fix

Fixed Accelerometer has lagged on iOS
  • Loading branch information...
minggo committed Feb 11, 2015
2 parents 6bcbadf + f34b86f commit 6f2819ec5a3a73efdc834274f9587f92f90949af
Showing with 3 additions and 0 deletions.
  1. +3 −0 cocos/platform/ios/CCDevice-ios.mm
@@ -38,6 +38,8 @@ of this software and associated documentation files (the "Software"), to deal
#import<CoreMotion/CoreMotion.h>
#import<CoreFoundation/CoreFoundation.h>

#define SENSOR_DELAY_GAME 0.02

@interface CCAccelerometerDispatcher : NSObject<UIAccelerometerDelegate>
{
cocos2d::Acceleration *_acceleration;
@@ -69,6 +71,7 @@ - (id) init
if( (self = [super init]) ) {
_acceleration = new cocos2d::Acceleration();
_motionManager = [[CMMotionManager alloc] init];
_motionManager.accelerometerUpdateInterval = SENSOR_DELAY_GAME;
}
return self;
}

0 comments on commit 6f2819e

Please sign in to comment.