Paul, I just spent the morning playing with the Android and your suggestions.
I added the following at line 400 of Core.cpp in the <app>/jni directory:
if (g_bIsTablet) agk::Print("Tablet");
else agk::Print("Phone");
I set the frame rate at 5 and did this in the accel function:
uString str;
str.Format( "X: %.2f, Y: %.2f, Z: %.2f ", x, y, z );
agk::Print( str );
str.Format("pax=%d pmod=%.2f lax=%d lmod=%.2f",g_iPortraitAxis,g_iPortraitModifier,g_iLandscapeAxis,g_iLandscapeModifier);
agk::Print( str );
Simple output of the device type, axis and modifer values:
The device reported itself to be a Tablet.
g_iPortraitAxis=0
g_iPortraitModifier=-1
g_iLandscapeAxis=1
g_iLandscapeModifier=-1
Reported orientation while held in portrait(1): 3
Reported orientation while held in landscape(3): 2
For the rest:
All the values from accel fluctuated +/-0.01 when device left sitting on desk. The fluctuations were a bit more when being held tilted due to hand trembles.
Held level in portrait (orientation 1):
accel X (aX): 0.05
accel Y (aY): 0.03
accel Z (aZ): 0.99
GetDirectionX (rX): -aX
GetDirectionY (rY): aY
Held tilted down (towards me) in portrait:
aX: 0.06
aY: 0.62
aZ: 0.80
rX: -aX
rY: aY
Held tilted up (away from me) in portrait:
aX: 0.06
aY: -0.78
aZ: 0.60
rX: -aX
rY: aY
Turned left to landscape (orientation 3, nominally) and left level:
aX: 0.06
aY: 0.02
aZ: 0.99
rX: aY
rY: aX
Held tilted down (towards me) in landscape:
aX: 0.70
aY: 0.03
aZ: 0.75
rX: aY
rY: aX
Held tilted up (away from me) in landscape:
aX: -0.66
aY: 0.01
aZ: 0.72
rX: aY
rY: aX
I would note that the reported X and Y were correct for the actual orientation and tilts applied. As was the GetDirectionAngle() value.
And I could not get it to go to the 'other' portrait and landscape orientations at all.
My game, did not seem to cooperate with reading the X/Y okay when I used 'SetOrientationAllowed(0,0,1,0)' in the program and 'android:screenOrientation="landscape"' in AndroidManifest.xml. It insisted that everything was 90 degrees off.
But when I used 'SetOrientationAllowed(1,1,1,1)' and 'android:screenOrientation="fullSensor"', it recognized X/Y perfectly. Except it would flip orientation and that is a problem for the game. Same result for 'android:screenOrientation="landscape"'.
Using 'SetOrientationAllowed(0,0,1,1)' brought back the same problem with reported values.
So, trying to force the Android to stay in landscape orientation causes a problem with the reporting. If allowed all orientations, it is happy, but anyone who needs to force landscape only will not be.
Cheers,
Ancient Lady