How do I Detect the DPI of a Device?

Get help using Construct 2

Post » Thu Jun 18, 2015 2:52 am

I'm trying to make my GUI scale correctly for Android devices, but I need to know the DPI since if use "High DPI DIsplay" is checked everything is rendered larger that it is.

So, is there a way to detect the DPI?
Follow me on Twitter @evgLabs
B
34
S
14
G
4
Posts: 251
Reputation: 4,074

Post » Thu Jun 18, 2015 3:30 am

Really, i don't know any Construct 2 default/custom plugin that have a expression that gets the device's DPI. You can get it with thiese "Browser" expressions, ScreenWidth and ScreenHeight
See more in: antiblocklinks|https://www.scirra.com/manual/110/browser
Liked something I say?
Tip. My Bitcoin address: 1PLaeKmXQ8vEdGGJqXMq3KyB8hxeddxeSv
B
28
S
9
G
4
Posts: 359
Reputation: 4,246

Post » Thu Jun 18, 2015 3:31 am

These expressions don't detect the DPI, but the pixels scale of device.
Liked something I say?
Tip. My Bitcoin address: 1PLaeKmXQ8vEdGGJqXMq3KyB8hxeddxeSv
B
28
S
9
G
4
Posts: 359
Reputation: 4,246

Post » Thu Jun 18, 2015 10:21 am

Letterbox mode should scale everything correctly regardless of the DPI setting.
Scirra Founder
B
405
S
239
G
91
Posts: 24,760
Reputation: 197,314

Post » Thu Jun 18, 2015 10:31 am

YetAnotherSuperhero Read this tutorial. Resolution for Android game

https://www.scirra.com/tutorials/1400/r ... droid-game
B
261
S
46
G
15
Posts: 1,997
Reputation: 41,873

Post » Thu Jun 18, 2015 1:12 pm

Hi Ashley, the letterbox scale will also enlarge the GUI which I don't want.

I'm using crop mode and have code to shrink the GUI if the window is smaller than a certain size. But with the use High DPI the code doesn't work and the GUI is not shrunk down enough.
Follow me on Twitter @evgLabs
B
34
S
14
G
4
Posts: 251
Reputation: 4,074

Post » Fri Jun 19, 2015 1:58 am

You need use "@" to mention people here, as @Ashley .
Liked something I say?
Tip. My Bitcoin address: 1PLaeKmXQ8vEdGGJqXMq3KyB8hxeddxeSv
B
28
S
9
G
4
Posts: 359
Reputation: 4,246

Post » Fri Jun 19, 2015 8:31 am

Export it with outer scale
B
261
S
46
G
15
Posts: 1,997
Reputation: 41,873


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 51 guests