mirror of https://github.com/axmolengine/axmol.git
Merge pull request #10442 from Dhilan007/v3-accelerometer-fix
Fixed Accelerometer has lagged on iOS
This commit is contained in:
commit
3a4e9ced46
|
@ -38,6 +38,8 @@
|
||||||
#import<CoreMotion/CoreMotion.h>
|
#import<CoreMotion/CoreMotion.h>
|
||||||
#import<CoreFoundation/CoreFoundation.h>
|
#import<CoreFoundation/CoreFoundation.h>
|
||||||
|
|
||||||
|
#define SENSOR_DELAY_GAME 0.02
|
||||||
|
|
||||||
@interface CCAccelerometerDispatcher : NSObject<UIAccelerometerDelegate>
|
@interface CCAccelerometerDispatcher : NSObject<UIAccelerometerDelegate>
|
||||||
{
|
{
|
||||||
cocos2d::Acceleration *_acceleration;
|
cocos2d::Acceleration *_acceleration;
|
||||||
|
@ -69,6 +71,7 @@ static CCAccelerometerDispatcher* s_pAccelerometerDispatcher;
|
||||||
if( (self = [super init]) ) {
|
if( (self = [super init]) ) {
|
||||||
_acceleration = new cocos2d::Acceleration();
|
_acceleration = new cocos2d::Acceleration();
|
||||||
_motionManager = [[CMMotionManager alloc] init];
|
_motionManager = [[CMMotionManager alloc] init];
|
||||||
|
_motionManager.accelerometerUpdateInterval = SENSOR_DELAY_GAME;
|
||||||
}
|
}
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue