Current device resolution

Hi, I was wondering whether there is possibility to determine the current device resolution no matter what scale mode I’m using? For example I’m using letterbox scale mode having width 320px a and height 480px. When running on iPad everything is fine just want to know whether I’m able to read 768x1024 resolution of the current hardware?

Thanks [import]uid: 94579 topic_id: 18225 reply_id: 318225[/import]

may i ask why you need this? [import]uid: 16142 topic_id: 18225 reply_id: 69716[/import]

hey, just check display.contentScaleX and display.contentScaleY… you may use those scaling factors for your purpose. [import]uid: 11686 topic_id: 18225 reply_id: 69718[/import]

When using letterbox mode display.contentScaleX and display.contentScaleY are always equal. Which is correct I think because of the meaning of the letterbox mode itself. Nevertheless I need to know the real device resolution (need to move an image according to the current device resolution but still using letterbox mode). [import]uid: 94579 topic_id: 18225 reply_id: 70061[/import]

This is a sample config.lua file;

application =  
{  
 content =  
 {  
 width = 320,  
 height = 480,  
 scale = "letterbox",  
 xAlign="left",  
 yAlign="top",  
 fps = 60,  
 imageSuffix =  
 {  
 ["@2x"] = 1.8,  
 },   
 },  
}  

With this setup above you get original device resolution by checking display.contentScaleX. i.e.:

if display.contentScaleX equals 1 then device has non retina display (320x480) **1
if display.contentScaleX equals 0.5 then device has retina display (640x960) **2
else device is iPad (1024x768)

note: **1, **2: I can not remember exact scaling factors for both displays. they may be interchanged… [import]uid: 11686 topic_id: 18225 reply_id: 70132[/import]

Yeah, this is clear. There is really no problem on iOS. The problem is Android where there are many resolution possible. When I develop an application using your config.lua file - how do I determine for example Samsung Galaxy Tab 10.1 resolution 1280x800 from the display.contentScaleX and display.contentScaleY when they are equal? [import]uid: 94579 topic_id: 18225 reply_id: 70148[/import]

Did you ever get a proper solution to this for Android models? Looking around myself now and could really use an answer.

Edit: Ok, a little further digging in the content properties I found display.screenOriginX and display.screenOriginY. The screenOriginY looks like the value I need to bump things up when using “letterbox” in my config.lua for tall Android resolutions. Hope this helps someone else. [import]uid: 17341 topic_id: 18225 reply_id: 71458[/import]

Hi ,

I’m looking for a way to get the device native resolution within the config.lua. This would be great because It could bypass the need for testing the the actual model devices, and work as well with future devices.
This is my config.lua which is working well in all corona skins.

[blockcode]

model = system.getInfo(“model”)
print("Device = ", model)
_W = 360

– If it was possible to get the device native resolution the following code could be replaced by
– something like this

– _H = deviceNativeHeight / deviceNativeWidth * _W
if (model==“iPad”) then
_H = 480
elseif (model==“iPhone” or model ==“iPhone Simulator” or model ==“iPod touch”) then
_H = 540
elseif (model==“Galaxy Tab” or model==“Nook Color” or model==“Kindle Fire”) then
_H = 615
elseif(model==“Sensation” or model==“Droid”) then
_H = 640
elseif(model==“Nexus One” or model==“GT-I9100”) then
_H = 600
else
_H = 560
end

– _W and _H are the dimensions of the screen regardless the device.
– For example (0.5 * _W , 0.5 *_H ) point the center of the screen on any device

_G.fps=60

application =
{
content =
{

width = 360,
height = 480,
scale = “letterBox”,
xAlign=“left”,
yAlign=“top”,
fps = _G.fps,
antialias = false,
imageSuffix =

{
["@2x"] = 1.5,
},
},
}

[/blockcode]
All objects in my code are placed in relative coordinates to _W and _H .

Have anyone found a solution for this?

Thanks in advance… [import]uid: 109913 topic_id: 18225 reply_id: 83767[/import]