rosancoderian

How to lock the device orientation?

Recommended Posts

I believe you can't lock the browser from switching to landscape mode but you can force the game to work only in a certain orientation and display a message to the user that he should switch to the correct orientation.

 

You can see this example in the Full Screen Mobile Template in the Boot state. It uses the forceOrientation method of the ScaleManager to force the game in a certain orientation and displays a message to the user whenever the wrong orientation is entered using the enterIncorrectOrientation signal.

Share this post


Link to post
Share on other sites

i using intel xdk to build app to mobile device .. so i using funtion

 

 

function onDeviceReady(){

....

intel.xdk.device.setRotateOrientation("portrait");

inte.xdk.device.setAutoRotate(false);

...

 

}

document.addEventListener("intel.xdk.device.ready", onDeviceReady, false);

////

code game with phaser JS

 

you can try it ...

Share this post


Link to post
Share on other sites

Yes as @next mentioned, it works on Intel XDK and the orientation is locked. Even if you minimize the app and the orientation gets to portrait, once you resume the app it will switch to landscape again and lock. I am talking about android.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.