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

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