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

Get help using Construct 2

Post » Sun Apr 13, 2014 10:53 pm

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
Image
B
33
S
11
G
2
Posts: 563
Reputation: 5,141

Post » Mon Apr 14, 2014 1:00 am

This should be done about the LayoutScale variable.

Tell me if it does not work.
B
15
S
3
G
5
Posts: 396
Reputation: 4,977

Post » Mon Apr 14, 2014 4:31 am

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?
Image
B
33
S
11
G
2
Posts: 563
Reputation: 5,141

Post » Mon Apr 14, 2014 5:29 am

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

Dont know if it works, but try. I am not that mathematic guru -.-
B
15
S
3
G
5
Posts: 396
Reputation: 4,977

Post » Mon Apr 14, 2014 9:47 am

ruskul wrote: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
Game design is all about decomposing the core of your game so it becomes simple instructions.
B
52
S
22
G
18
Posts: 2,122
Reputation: 17,093

Post » Tue Apr 15, 2014 2:33 am

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.
Image
B
33
S
11
G
2
Posts: 563
Reputation: 5,141

Post » Thu Apr 17, 2014 7:06 pm

viewtopic.php?t=84782&start=0

custom plugin that gets info about the users monitor
Image
B
33
S
11
G
2
Posts: 563
Reputation: 5,141


Return to How do I....?

Who is online

Users browsing this forum: Lordshiva1948, Ninjadoodle, plinkie, sublimate and 10 guests