Scaling on-screen controls

Monkey Targets Forums/Android/Scaling on-screen controls

Sensei(Posted 2014) [#1]
So, I was thinking about a common parameter one could use on android devices (and possibly iOS), that could be used to scale on screen touch controls in a game.

For example, both my Nexus 5 and Nexus 10 have almost the same screen resolutions (1920x1080 vs 2560x1600), but are physically drastically different in size.

Is there a way to work out a scale factor based on screen resolution and DP/DPI?

A mate said that android devices seem to return the DP and DPI values as well as screen sizes, so one would assume you could get access to those parameters vie extern commands into monkey code.

No point having a huge on-screen d-pad on a 10" device and a hardly usable one on a 5" or less device! :)

Any suggestions please!


Midimaster(Posted 2014) [#2]
yes, we already descriped a way to do that here:
http://www.monkey-x.com/Community/posts.php?topic=4958&
See also the discussion, that follows on my function!


A second source is here:
http://www.monkey-x.com/Community/posts.php?topic=5415


Sensei(Posted 2014) [#3]
Thanks a million Midimaster! That's exactly what I'm looking for! :)