2

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.

Trevor Reid
  • 3,310
  • 4
  • 27
  • 46
user3292309
  • 45
  • 1
  • 6

2 Answers2

2

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 :)

Trevor Reid
  • 3,310
  • 4
  • 27
  • 46
0

You can also do it using Intel XDK

intel.xdk.device.setRotateOrientation("landscape");
intel.xdk.device.setAutoRotate(false);
svenar
  • 115
  • 11
Sky Walker
  • 978
  • 1
  • 9
  • 22