GML: Lock mobile device to initial orientation

G

Gaspode

Guest
I want users of my game to be able to run it in either landscape or portrait but I don't want them to change orientation once it's playing. Is there any way to stop orientation changes?
 
G

Gaspode

Guest
Ok, found the answer...


os_lock_orientation
 
Last edited by a moderator:
G

Gaspode

Guest
And now it's not solved.

I calculate whether I am in landscape or portrait mode and set all my globals up then call os_lock_orientation(true). If I hold my device in landscape mode, all is fine, but if I am holding it in protrait mode, it still runs in landscape mode but with all my globals (width, height and orientation) set as portrait... How strange - anybody experienced problems with this before?

EDIT
Curiouser and curiouser. If I force my app to only allow Portrait modes (Global settings) then hold the tablet in portrait mode, the app opens in landscape mode (but with device_height and width showing it as portrait i.e. height < width). Is this command broken, or am I? Can anybody try this out and comment? Thanks.
 
Last edited by a moderator:

Tsa05

Member
I'm afraid I haven't experienced this issue on Android devices so far. I haven't done anything on Nougat yet, but the projects I've done on Android run in portrait-only without issue~
 
Top