I'm not insane - gyroscope swaps axes when the screen orientation is inverted when holding the phone upside down.

This commit is contained in:
pelya
2014-06-29 02:59:58 +03:00
parent 283b1d6b3d
commit 4cd55d4d07
3 changed files with 46 additions and 16 deletions

View File

@@ -719,6 +719,16 @@ class DemoRenderer extends GLSurfaceView_SDL.Renderer
Thread.sleep(50); // Give some time to the keyboard input thread
} catch(Exception e) { };
}
// We will not receive onConfigurationChanged() inside MainActivity with SCREEN_ORIENTATION_SENSOR_LANDSCAPE
// so we need to create a hacky frame counter to update screen orientation, because this call takes up some time
mOrientationFrameHackyCounter++;
if( mOrientationFrameHackyCounter > 100 )
{
mOrientationFrameHackyCounter = 0;
context.updateScreenOrientation();
}
return 1;
}
@@ -913,6 +923,7 @@ class DemoRenderer extends GLSurfaceView_SDL.Renderer
public int mWidth = 0;
public int mHeight = 0;
private ClipboardManager clipboard = null;
int mOrientationFrameHackyCounter = 0;
public static final boolean mRatelimitTouchEvents = true; //(Build.VERSION.SDK_INT >= Build.VERSION_CODES.FROYO);
}