How would I lock the orientation for a mobile device using js, phaser or jquery? Is there a generic way to do it so it locks orientation regardless of the platform or device used?
I basically want to lock landscape mode for my browser based game.
How would I lock the orientation for a mobile device using js, phaser or jquery? Is there a generic way to do it so it locks orientation regardless of the platform or device used?
I basically want to lock landscape mode for my browser based game.
There is a forceOrientation
and a forcePortrait
method in the ScaleManager
class. See docs.
We also usually use an image to ask the users to flip their phones.
As well, you can listen to the incorrectOrientation
signal so know when the game is in the undesired orientation.
I hope it helps :)
You can also do it using Intel XDK
intel.xdk.device.setRotateOrientation("landscape");
intel.xdk.device.setAutoRotate(false);