Is there any way to see what device the App is running on?

I would like to write one App targets two platform (iPhone & iPad).

Is there any way to see what device the App is running on?

ex: return device information
if device=ipad then
else
end

So I can implement it.
Thank you.
[import]uid: 4992 topic_id: 1322 reply_id: 301322[/import]

This was requested so many times here. [import]uid: 5712 topic_id: 1322 reply_id: 3560[/import]

If you only need to figure out if you are on a iPhone or iPad you could base it off the screen width and height.

print("Screen W x H is " .. display.contentWidth .. " x " .. display.contentHeight)  

Tom [import]uid: 6119 topic_id: 1322 reply_id: 3562[/import]

That works only if you don’t use the automatic scaling feature through the build.settings. [import]uid: 5712 topic_id: 1322 reply_id: 3564[/import]

Yap, that’s the problem. Cause I need to use scaling feature. [import]uid: 4992 topic_id: 1322 reply_id: 3566[/import]

What about using display.viewableContentWidth and display.viewableContentHeight?
They are mentioned in the 2.0 Beta document (under Dynamic Content Scaling) and sounds like they return the actual screen width and height. Except for the single mention I don’t see them documented anywhere else.

Tom [import]uid: 6119 topic_id: 1322 reply_id: 3572[/import]

Thank you. However, if you set

application =  
{  
 content =  
 {  
 width = 320,  
 height = 480,  
 scale = "letterbox"  
 },  
}  

in config.lua, display.viewableContentWidth & display.contentWidth & display.stageWidth are all 320. [import]uid: 4992 topic_id: 1322 reply_id: 3573[/import]

What do they say if you set “scale” to “zoomEven” or “zoomStretch” ?

Tom [import]uid: 6119 topic_id: 1322 reply_id: 3575[/import]

just tested it…nothing change. [import]uid: 4992 topic_id: 1322 reply_id: 3577[/import]

Sounds like those properties are not working since they were mentioned under the Dynamic Content Scaling section. Since they are not documented we don’t if it’s a bug or not.

Thanks,
Tom [import]uid: 6119 topic_id: 1322 reply_id: 3578[/import]

I think they do what they have documented. If your screen “covers” part of the scaled area you get a lower “viewable” value as result. Wheres the content area is the same.

Example… you render 320 … the screen is 400 you get viewable 320 content 320… if your screen is 200 you get viewable 200 content 320 …

The problem is that you can’t get the native resolution at all…

I think you can skip this whole stuff and just scale and move the stage by itself. I tried that once and it worked ok. You can’t have a cool start image that way though.

This relates to my feature request that the letter-boxed representation should be center able!

If I know that there is say 60 pixels “unused” at the bottom… I can offset the origin of the stage by 30 pixels. But there is no way to find this out … afaik!
[import]uid: 6928 topic_id: 1322 reply_id: 3589[/import]