deviceType

Hey everyone!

Now that the iPhone 6 and 6 plus is out, I think that if you’d like to draw something in Codea, it makes things harder. What I noticed, WIDTH and HEIGHT won’t be an objective scale anymore, as the new iPhone has a larger pixel density with a smaller screen, if you’d like to draw an ellipse, or more ellipses, on the iPhone it would be really small compared to the iPad air, which has a big screen. That’s why I’d suggest something like deviceType so our app can decide, what size should it draw.

I think we’re going to get a lot of questions like this

One for you, I think, @Simeon

@StUdIoGuY According to apple, apps made for the iPhone 5/5s/5c will ‘just work’ on the new devices. Just like the WIDTH and HEIGHT on a Retina iPad is the same as on a non-Retina one (1024x768), it will probably work the same way for the new iPhones and the iPhone 5/5s/5c. On Retina iPads adding a .5 will be one pixel on the screen, so on the iPhones it may be something like that. Of course, I don’t know for certain.

I don’t know anything about the iPhone 6, but you can already get the current device’s type using deviceMetrics(), which returns a table with a bunch of useful variables in it, specifically platform.

Yea, I figured it out, Thank You! :slight_smile:

@StUdioGuY Codea will be updated for iOS 8. But irrespective of that, all the devices (iPhone 4, 5, 6, 6+) present the same logical point size as the same physical size. You simply get a larger canvas on the 6 and 6+.

So you should get the following values for WIDTHxHEIGHT in a properly built app:

  • iPhone 4: 320x480 (@2x)
  • iPhone 5: 320x568 (@2x)
  • iPhone 6: 375x667 (@2x)
  • iPhone 6+: 414x736 (@3x)

So something like rect(0,0,50,50) on each of those displays should render at almost exactly the same physical size (if you were to measure it as displayed on the screen in millimetres). This also goes for the iPad mini. On the full size iPad such a rectangle would render slightly larger.

Codea will need an update to handle @3x assets correctly, but aside from that you should probably make your layouts dynamic with respect to the logical WIDTH HEIGHT rather than using deviceMetrics()

but I want to use the 1920*1080 pixels on the 6+. Why can’t I?

@CodingOnNapkins Because you will actually be using 1242x2208 pixels on the 6+ (remember it’s @3x!). The hardware downscales to the native 1080x1920 panel afterwards.

Edit: The reported WIDTH and HEIGHT will be what I reported in the post above, however your graphics will render sharp as if they are rendering to a 1242x2208 native resolution. This is exactly how Codea works with retina iPads right now.

@Simeon , iPad splash screens are missing when I run my Project on my iPad