Quick Links: Download Gideros Studio | Gideros Documentation | Gideros community chat | DONATE
Get screen density — Gideros Forum

Get screen density

StoffeStoffe Member
edited December 2011 in General questions
I would like to have a function to access screen density of the device. In most cases, the autoscaling features are just fine, but I have a use case for finding out how big, say an approximate centimeter would be on the actual screen of the device. One example would be to show a circle that the user should put a finger into - I want it to be sized properly for a fingertip to fit into, no matter if it's a phone or a tablet.

On Android, I think I could calculate this with the help of
getResources().getDisplayMetrics().density
, not sure what the same thing would be on iOs or in computer player. For iOs, if there is no such API, there are few enough models that maybe it could be a lookup table.

Any other suggestions on how to figure this out would also be welcome. :) Especially if I'm thinking wroung about using density + screen size. A circle with diameter of 1cm or thereabouts would be OK for the fingertip example, maybe a bit bigger. Does not have to be exact, as long as it's not very small on a phone or very big on a tablet. In older days, probably guessing from the screen size in pixels would be enough, but now some phones have more pixels than some tablets. :)

Likes: MikeHart, atilim

Tagged:
+1 -1 (+2 / -0 )Share on Facebook

Comments

Sign In or Register to comment.