Pixels per Centimeter - Dynamically accessing that for various devices
fmakawa
Member Posts: 565
Hi folks, I doubt this can be done but I'm trying anyway. Is there a way to read a devices resolution and known how many pixels are crammed in a cm? I find myself needing to know the swipe distances and needing to calculate them but pixel density varies device to device and I was wondering if there is a way to calculate using device specs GS has access to? @Armelline has an amazing swipe factory but by my understanding the values for the devices shown were preconfigured rather than calculated with GS. Any ideas folks?
Comments
Just have a table with all the popular device Model numbers linked to Horizontal pixel count / Horizontal screen size (in cm).
So for example if the Model attribute returns 'iPad4,6' then you know you have an iPad mini, you also know the screen is 20cm (longest side) at 2048 pixels, therefore it's 102.4ppcm.
https://www.theiphonewiki.com/wiki/Models
Thanks. But I am making my game for Android too and eventually Windows if they fix the HTML5 bugs which means a lot of displays. > @Socks said:
We have no way of knowing the exact physical dimensions of the devices the game is running on (without reference to a table of information like @Socks suggests).
Contact me for custom work - Expert GS developer with 15 years of GS experience - Skype: armelline.support