Jump to content

Getting and using browser width && height


lukaMis
 Share

Recommended Posts

Hi

 

I am using it like this:

var gameWidth = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth;var gameHeight = window.innerHeight || document.documentElement.clientHeight ||document.body.clientHeight;...game = new Phaser.Game(gameWidth, gameHeight, Phaser.AUTO, 'MainGameState' );

Is there any better or more used approach within Parser?

 

tnx

Luka

 

Link to comment
Share on other sites

Hmm. For my first really simple game i do not need resize of whole game. Also i need game area to be as big as browser of device is. 

I check how big browser area that contains game is and then initialize game accordingly. 

I do scale down assets if i have less than 768 px (less than portrait iPad).

 

How about portait and landscape modes. Are there any build in methods in Parser to deal with that?

I know that i can't force desired mode from html5.

Is the only thing i can do put game to pause and encourage user to switch back via css media queries?

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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