Jump to content

Detect current device's screen resolution


Batzi
 Share

Recommended Posts

Is there a way to detect the device's resolution on which the game is running?

 

I'd like to scale things in my game based on that. For some reason, when I try my game on a different PC monitor, the height is not always the same so a black bar at the bottom is shown whenever I scroll the camera down. On my PC monitor, that bar isn't shown and it is limited to the edges of the map I am using.

Link to comment
Share on other sites

Are you using scale manager? Could try something like this, unless I am misunderstanding the question...

 

 

//scaling options

 
    this.scale.scaleMode = Phaser.ScaleManager.SHOW_ALL;
 
    //have the game centered horizontally
 
    this.scale.pageAlignHorizontally = true;
 
    this.scale.pageAlignVertically = true;
 
    //screen size will be set automatically
 
    this.scale.setScreenSize(true);
Link to comment
Share on other sites

 

Are you using scale manager? Could try something like this, unless I am misunderstanding the question...

 

 

//scaling options

 
    this.scale.scaleMode = Phaser.ScaleManager.SHOW_ALL;
 
    //have the game centered horizontally
 
    this.scale.pageAlignHorizontally = true;
 
    this.scale.pageAlignVertically = true;
 
    //screen size will be set automatically
 
    this.scale.setScreenSize(true);

 

Thank you! That helped a lot!! Now it is scaling properly based on the device I am using! Thank you again! :D

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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