Jump to content

Forcing landscape on mobile?


Martiny
 Share

Recommended Posts

I can't find the command that forces landscape. I tried game.stage.scale.forceLandscape = true; but I guess it's not it. I tried searching in the forums but the old examples seems to not work.

 

If I can force it into landscape my game runs properly, except for the address bar in the mobile chrome. Is there a way to cut it out? My goal is to make an app so I don't have to deal with this address space, but I don't know how to do it with HTML5 yet.

Link to comment
Share on other sites

It's not possible to "force" landscape mode in HTML5 games. You can check for device orientation, though, and account for it in other ways. Try any of my games on mobile for an example.

 

I just tried. Well, thanks for the answer! I'm a little bit sad about it because it made me wonder if playing games in the browser is actually optimal. My game can only be played properly when in landscape, but I know some people that disable the device orientation thingy in their fones, so I thought that there would be a way of forcing it.

 

I gave up on hiding the address bar. It doesn't make my game bad, but It's uglier. 

 

Thanks for the attention.

Link to comment
Share on other sites

I'm working on a phaser port of a game of mine that is landscape only.  All I do is show a notice to rotate the phone when they go portrait mode.  This is well iilustrated in the Boot.js of the full screen mobile example

 

https://github.com/photonstorm/phaser/blob/master/resources/Project%20Templates/Full%20Screen%20Mobile/src/Boot.js

Link to comment
Share on other sites

I'm working on a phaser port of a game of mine that is landscape only.  All I do is show a notice to rotate the phone when they go portrait mode.  This is well iilustrated in the Boot.js of the full screen mobile example

 

https://github.com/photonstorm/phaser/blob/master/resources/Project%20Templates/Full%20Screen%20Mobile/src/Boot.js

 

thats what i do too BUT  if the game went fullscreen already and you change the rotation of your device then the content will be streched into portrait an the notice is not shown anymore...   

also it should immediately pause when showing the notice..   

 

how to solve this??

 

you can try it on my demo game here:  http://test.xapient.net/phaser/ALL/

Link to comment
Share on other sites

  • 1 year later...

Is there any ready to use solution to force landscape mode on mobile? (iOS and Android)

 

 

thats what i do too BUT  if the game went fullscreen already and you change the rotation of your device then the content will be streched into portrait an the notice is not shown anymore...   

also it should immediately pause when showing the notice..   

 

how to solve this??

 

you can try it on my demo game here:  http://test.xapient.net/phaser/ALL/

 

I like how you made it. Is there any way to hide address bar automatically when you rotate in landscape mode?

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.

Guest
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.

Loading...
 Share

  • Recently Browsing   0 members

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