Jump to content

Staying at portrait orientation


Recommended Posts

I have been playing around with panda.js the last couple days and I have a question: Is there a way to keep it at portrait orientation even after moving a mobile device sideways where it would switch to landscape orientation? By default, if it is set for portrait orientation and the device is moved sideways, the screen will white. If properties are set in config, we can display a message telling the user to move back to portrait. However... what I am interested in is keeping the game at portrait regardless of how the mobile device is moved. Is there a way to configure this using panda.js?

Link to comment
Share on other sites

  • 1 month later...

Epnu - I would like to keep the user in portrait mode even they turn their device sideways. Using the rotateScreen: false property value in config.js allows for the game to change back and forth from landscape to portrait depending on how the user turns their device. Is there a way in pandajs to to keep the app at a specified orientation?


antbrooksuk - I'm not sure where I would put that code snippet when using pandajs. Any ideas would be great.

Link to comment
Share on other sites

What you can do is to rotate the screen on orientation change.



landscape 480 width 320 height,

on portrait -> resize to 320 width and 480 height, rotate the stage by 90 degree (or -90 degree, depending on orientation)


Then all you need to account for is that e.pageX become e.pageY and e.pageY becomes height - e.pageX

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...