Last active
September 6, 2015 08:52
-
-
Save idimiter/f3dd1a706940da32534f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- CCDevice.mm (revision 6) | |
+++ CCDevice.mm (working copy) | |
@@ -102,11 +102,12 @@ | |
- (void)accelerometer:(CMAccelerometerData *)accelerometerData | |
{ | |
- _acceleration->x = accelerometerData.acceleration.x; | |
- _acceleration->y = accelerometerData.acceleration.y; | |
- _acceleration->z = accelerometerData.acceleration.z; | |
- _acceleration->timestamp = accelerometerData.timestamp; | |
- | |
+#warning Get current data as opposite to the one from the queue. Its an ugly hack and needs to be replaced! | |
+ _acceleration->x = _motionManager.accelerometerData.acceleration.x; | |
+ _acceleration->y = _motionManager.accelerometerData.acceleration.y; | |
+ _acceleration->z = _motionManager.accelerometerData.acceleration.z; | |
+ _acceleration->timestamp = _motionManager.accelerometerData.timestamp; | |
+ | |
double tmp = _acceleration->x; | |
switch ([[UIApplication sharedApplication] statusBarOrientation]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The laggy issue that this fixes has existed since cocos2d-x 3.0 and currently exists in 3.5.
I hope that this or an alternative fix makes it into 3.6, since the laggyness/slowness is so significant that it seems to build up and make the accelerometer take up to 10 seconds to respond on iOS after running for about 30 seconds.
Thanks for posting this fix!