Pixels per Centimeter - Dynamically accessing that for various devices

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

  • SocksSocks London, UK.Member Posts: 12,822

    @fmakawa said:
    Is there a way to read a devices resolution and known how many pixels are crammed in a cm?

    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.

  • fmakawafmakawa Member Posts: 567

    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:

  • ArmellineArmelline Member, PRO Posts: 5,397
    edited October 2016

    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).

Sign In or Register to comment.