Universal Apps...

Hello everyone

When making an app for iOS, and wanting to make it universal… I know you will need to size the graphics relative to the width and height of the screen instead of hard numbers. Also need to to set up a device check when the apps first starts. Which is already somewhat confusing…

Does the new iPhone 6 confuse things even more by adding 2 more different sizes to the universal app game?

Are there any good tutorials for making an app universal with Codea?

Thanks in advance!

@Crumble Hello, just to note that there was a thread started not long ago that covered the new dimensions for iPhone 6, from what I saw it’s going to be x3 on normal size like retina is x2 of normal size. I’m not sure just how that will work (1/2 is 0.5, 1/3 is 0.333333…) maybe someone will clarify. There are many threads on this forum that discuss a) Device types and setting WIDTH/HEIGHT accordingly and b) For making universal apps.

@Luatee Since the retina display at x2 and uses pixels at .5, it seems logical that the x3 display might use pixels at .33 and .66.

@dave1707 so there’s a 0.34 jump towards 0.66 and 1? Might just be me but stuff like that bugs me, but it won’t matter if there’s rounding I guess.

@Luatee I don’t know that for sure, but if there’s a .33 jump from 1.00 to 1.33, then another .33 jump to 1.66, then a .34 jump to 2.00, I don’t think that .01 difference is going to be noticeable. But I don’t know how else they can get a x3 increase without doing something like that.

@Luatee Maybe the next increases of x4 and x5 won’t have a rounding problem. The divisions will be .25/.50/.75 and .2/.4/.6/.8 .

@dave1707 I don’t think it’s going to be noticeable either depending on how it’s implemented, if it’s a 0.33 increment all the way then obviously that will soon start looking wrong… We’ll have to see what ingenuity the Codea team bring to the table this time 8->

x4 and x5 will both work fine as long as aspect ratios aren’t changed drastically, although thinking about it so you think Apple (and others) will put the pixel density up that much? I know Samsung and Sony have both hit over 500ppi which is utterly crazy.

Why not have WIDTH and HEIGHT be the number of pixels on device screen and add PIXELSperINCH to let the people who want to draw lines 1 inch long do so.

For my apps, I want to be able to use every pixel on the device.

I’ll use a magnifying glass if I have to but I need the real estate and accurate pixel drawing for what I do.

@CodingOnNapkins you can use every pixel:

1 “actual” pixel on your device size = 1.0 / ContentScaleFactor

If you want to know the pixel WIDTH and HEIGHT then:

pixelWidth = WIDTH * ContentScaleFactor
pixelHeight = HEIGHT * ContentScaleFactor

If you need to draw physically accurate sizes then you need to know the dimensions of the display. We don’t know this and so can’t tell you (whether your screen is on an iPad mini or a regular iPad for example). You can determine this by using the device model information returned by deviceType() — that’s probably the only suitable use for this function.

@Simeon There is no deviceType()…?

@SkyTheCoder Comment removed, my mistake.

@dave1707, @Simeon, Sky is correct, I believe you meant to use deviceMetrics()

@JakAttak Thanks, you’re right. It is deviceMetrics().

@SkyTheCoder sorry it was a typo, as @JakAttak says — I meant deviceMetrics()