android: screen rotation not detected by GLB.

Previous topic - Next topic

ampos

Code (glbasic) Select
while true
PRINT " X:"+INTEGER(100*GETJOYX(0))+" Y:"+INTEGER(100*GETJOYY(0))+" Z:"+INTEGER(100*GETJOYZ(0)),0,25
GETSCREENSIZE sx,sy
PRINT "ScSize1: "+sx+"x"+sy,0,125
GETDESKTOPSIZE dx,dy
PRINT "DeSize: "+dx+"x"+dy,0,150
                SHOWSCREEN
wend


In the manifiest you can have       

Code (glbasic) Select
android:screenOrientation="sensor"
android:configChanges="orientation|keyboardHidden"


If you set in android settings 1000x1000 it will open the max resolution with the orientation of the device on the launch time.

If I launch my test app in vertical, it will open a 480x800 screen. If I launch the app whith the tablet in horizontal, it will open a 800x480.

If I rotate the tablet, the screen will change orientation, but it will be printint in thw wrong position and getscreensize and getdesktopsize will not change, returning always the resolution the app had on launch time. But the mouse coordinates will return correct values. Also the sensor values will rotate (although in my device, X and Y are swapped).

EXAMPLE:
Tablet in horizontal position. Launch app. It opens at horizontal (correct), 800x480.
Sensors says X=-1 and Y=0.
Mouse X,Y=0 are on Top Left coordinates.
Text is printed also begining in the top left corner.

Rotate the device 90º CW. Display will rotate also 90º (by Android system, not setorientation()).
The screens is 480x800, but getscreensize is still 800x480.
Sensor X=-1 (so it ha rotated)
Mouse X,Y=0 is at top left corner (it has rotated too).
text is printed at 0,400 coordinate (in middle of the screen).

Sorry, I dont know to to capture screenshoots.

Please, test this little app on your android devices.