How do I get the resolution of the device I am running the g

0 favourites
  • 7 posts
From the Asset Store
Full game Construct 2 and Construct 3 to post on Google Play
  • Hey,

    I need to be able to find the resolution of the device the game is running on.... Basically I am running the game in crop mode, if the screen is 2x a ceartain size I scale the layout by 2 and so on. The reason for this is that it is like integer scale mode but combined with scale out/ inner.

    I think this is the only way to do it but I may be wrong

  • This should be done about the LayoutScale variable.

    Tell me if it does not work.

  • Layout scale adjusts the scale of a layout. Indeed I would use this to control the zoom but before I can zoom I need to know how much. For that I need the resolution of the display....

    For example. Lets say I have a game with 100x100. On a 200x200 device I would set the layout scale to 2. on a 300x300 device I would set the scale to 2... crop would fill out the edges... Basically I would scale by whole numbers but I need to know the display resolution to do this.

    May question is - how do I find the resolution of the device?

  • about the pixels / layoutScale * the device pixels / new layout scale.

    Dont know if it works, but try. I am not that mathematic guru -.-

  • Layout scale adjusts the scale of a layout. Indeed I would use this to control the zoom but before I can zoom I need to know how much. For that I need the resolution of the display....

    For example. Lets say I have a game with 100x100. On a 200x200 device I would set the layout scale to 2. on a 300x300 device I would set the scale to 2... crop would fill out the edges... Basically I would scale by whole numbers but I need to know the display resolution to do this.

    May question is - how do I find the resolution of the device?

    The viewports expressions, or the browser expressions ScreenWidth and ScreenHeight should help

  • It turns out that you can only get the window resolution and not the device resolution. If I use crop mode and then ask for the window size I can do some math to figure out the amount to scale the layout.

    I wish there were an integer scale mode that supported a cropping out to fill the space.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • custom plugin that gets info about the users monitor

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)