Hello. If this question is solved somewhere else please point me to it, I didn't find it.
How do I change the screen orientation for when the user rotates the device? I'm making a game for which I only want to allow Landscape Left and Landscape Right.
@somezombiegm this is platform dependent and currently possible only on IOS
First right click on the project in Gideros Studio, select properties and then select ios and choose autorotation for devices you want, usually iphone and ipad
Click ok
Then you you get it exported to xCode, simply select both landscape modes there and it will autorotate only in these landscapes
@somezombiegm well android does not have internal implementation of autorotation as ios
you can try to implement it yourself, but it may be difficult and have some caveats
1) use accelerometer to and Application:getDeviceOrientation() to detect orientation changes 2) use centerly position sprite on the stage 3) rotate this sprite
but as I said, not the best way
we will be thinking on possible solutions on android about it further, to make them behave more as on ios
@ar2rsawseen I've found a solution that works for me. The way I test my game on devices (and perhaps everyone else, but I just know this one) is to export it, then import it with Eclipse and then run as Android application (but you need to instal the Android plugin and the API for the devices version).
So, the solutions is: on the Android Manifest add sensorLandscape on screen orientation:
Comments
First right click on the project in Gideros Studio, select properties and then select ios and choose autorotation for devices you want, usually iphone and ipad
Click ok
Then you you get it exported to xCode, simply select both landscape modes there
and it will autorotate only in these landscapes
you can try to implement it yourself, but it may be difficult and have some caveats
1) use accelerometer to and Application:getDeviceOrientation() to detect orientation changes
2) use centerly position sprite on the stage
3) rotate this sprite
but as I said, not the best way
we will be thinking on possible solutions on android about it further, to make them behave more as on ios
So, the solutions is: on the Android Manifest add sensorLandscape on screen orientation:
android:screenOrientation="sensorLandscape" =D