Quick Links: Download Gideros Studio | Gideros Documentation | Gideros community chat | DONATE
Automatic Screen Scaling vs Pixels Per Inch — Gideros Forum

Automatic Screen Scaling vs Pixels Per Inch

cubuspl42cubuspl42 Member
edited May 2013 in General questions
Let's say there are two devices - 4" smartphone A and 10" tablet B.
If A and B have same screen resolution, will Gideros treat them in the same way? If I want the button to be 20 mm (real-world mm) on both devices, can I achieve this with Gideros?

Comments

  • ar2rsawseenar2rsawseen Maintainer
    edited May 2013 Accepted Answer
    Well, if the resolution is the same, but dimensions of device in real world are different than the size of the button in real world, would also be different. As the scaling is proportional, at least Letterbox is.

    I haven't tried to achieve this, but there is a function:
    application:getScreenDensity()
    Which should return the screen density in pixels per inch. You could use that to calculate the button size yourself :)

    Likes: cubuspl42

    +1 -1 (+1 / -0 )Share on Facebook
  • Ok, so can I use getScreenDensity together with setLogicalDimensions and both ASS and Automatic Image Resolution will work? Is AIR ok with logical dimensions set at runtime?
  • ar2rsawseenar2rsawseen Maintainer
    As I said I haven't tried that, but theoretically yes, you should be able to calculate the real dimensions. The way you calculate it will depend on what exactly ASS you will be using.

    What do you mean by AIR?

    Likes: cubuspl42

    +1 -1 (+1 / -0 )Share on Facebook
  • AIR is Automatic Image Resolution - I didn't want to be cool, I used it after mentioning the full name :) Sorry, I'm lazy

    Likes: Platypus

    +1 -1 (+1 / -0 )Share on Facebook
  • ar2rsawseenar2rsawseen Maintainer
    :)
    Yes I think it should be cool with that ;)

    Likes: cubuspl42

    +1 -1 (+1 / -0 )Share on Facebook
  • PlatypusPlatypus Member
    edited May 2013
    I'm not confident that every manufacturer's device will return a value.

    Does the following code return a value on your mobile device;
    or does it display "Pixel Density Unknown"?

    It would be very helpful if many people would run the following code on as many different devices (not simulators) as possible, and report the results in this thread.
    local densityEnquirer = application:getScreenDensity()
     
    local words = TextField.new(nil, "Pixel Density Unknown")
    words:setPosition(107, 222)
    stage:addChild(words)
     
    if densityEnquirer then
     
    words:setText(densityEnquirer.." pixels per inch")
     
    end

    Likes: cubuspl42

    Kate's Catalogue of Travelling Theatre Centres :
    Meet Kate. Grey is her favourite colour. Maths is her favourite subject. Decency is her favourite type of behaviour.
    She definitely does not like jewellery or modelling, but loves aeroplanes and other machines made of aluminium.
    +1 -1 (+1 / -0 )Share on Facebook
  • ar2rsawseenar2rsawseen Maintainer
    @Platypus I think that nil value is only for desktop pcs and Macs (and maybe some other future platforms), all devices that I know (Android and IOS) return screen density
  • @Ar2rsawseen,
    That's good news. Thanks.

    (Off topic: By the way, did you submit your thesis?)
    Kate's Catalogue of Travelling Theatre Centres :
    Meet Kate. Grey is her favourite colour. Maths is her favourite subject. Decency is her favourite type of behaviour.
    She definitely does not like jewellery or modelling, but loves aeroplanes and other machines made of aluminium.
  • Fantastic! Good luck.
    Kate's Catalogue of Travelling Theatre Centres :
    Meet Kate. Grey is her favourite colour. Maths is her favourite subject. Decency is her favourite type of behaviour.
    She definitely does not like jewellery or modelling, but loves aeroplanes and other machines made of aluminium.
Sign In or Register to comment.