zoomStretch scaling bug?

@Ntero’s config.lua has a small problem:

local width, height = 0, 0  
if display.pixelHeight % 1024 == 0 then --It's an iPad height  
 width, height = 768, 1024  
else if display.pixelHeight % 568 == 0 then --It's an iOS Tall height  
 width, height = 320, 568  
else --Must be iOS normal  
 width, height = 320, 480  
end  
   

For things that are not iPad, they are scaled at 320px. For the iPad they are scaled at 768px. If you’re using 320 as the base, that should be:

width, height = 360, 480

For me I do something like this:

if string.sub( system.getInfo( "model" ),1,4) == "iPad" then  
 width, height = 360, 480  
elseif string.sub(system.getInfo("model",1,2) == "iP" and display.pixelHeight \> 960 then  
 width, height = 320, 568  
else  
 width, height = 320, 480  
end  

or something similar using @Ntero’s way of doing things.

EDIT to add: The reason I don’t just check system.getInfo(“model”) against “iPad” and do a sub-string is because if you’re running this in Apple’s simulator the model is “iPad Simulator”. Also we don’t know what model the iPad mini is going to return yet and if it’s iPad Mini then the sub-string bit future protects us.
[import]uid: 19626 topic_id: 32730 reply_id: 130304[/import]

Hi Rob,

Thank you for chiming in. I’m simply checking if the device has a “tall screen” or not. If not, I use the same config because I’m using the zoomStretch scale anyway. Below is my code (as per Ntero’s suggestion)–

local width, height = 0, 0  
if display.pixelHeight % 568 == 0 then --It's an iOS Tall height  
 width, height = 320, 568  
else --Must be iOS normal  
 width, height = 320, 480  
end  
  
application =  
{  
 content =  
 {  
 width = width,  
 height = height,  
 scale = "zoomStretch",  
   
 imageSuffix =  
 {  
 ["\_2x"] = 2,  
 }  
 },  
   
 notification =  
 {  
 iphone =  
 {  
 types =  
 {  
 "badge", "sound", "alert"  
 }  
 }  
 }  
}  

My problem is, how come the tall screen works on the iPhone 5 but not on the iPod Touch 5th gen? [import]uid: 44127 topic_id: 32730 reply_id: 130306[/import]

Hi Rob,

Thank you for chiming in. I’m simply checking if the device has a “tall screen” or not. If not, I use the same config because I’m using the zoomStretch scale anyway. Below is my code (as per Ntero’s suggestion)–

local width, height = 0, 0  
if display.pixelHeight % 568 == 0 then --It's an iOS Tall height  
 width, height = 320, 568  
else --Must be iOS normal  
 width, height = 320, 480  
end  
  
application =  
{  
 content =  
 {  
 width = width,  
 height = height,  
 scale = "zoomStretch",  
   
 imageSuffix =  
 {  
 ["\_2x"] = 2,  
 }  
 },  
   
 notification =  
 {  
 iphone =  
 {  
 types =  
 {  
 "badge", "sound", "alert"  
 }  
 }  
 }  
}  

My problem is, how come the tall screen works on the iPhone 5 but not on the iPod Touch 5th gen? [import]uid: 44127 topic_id: 32730 reply_id: 130306[/import]

The reason for the % is a sort of consistency/safety. It makes sense on the iPad for detecting Retina/non-retina, but for iOS Tall it’s more of a ‘just-in-case’ they come out with a non-retina tall screen (not likely). So it’s probably a non-issue if you replace % 568 == 0 with == 1136.

And yeah I wrote it off the top of my head, sorry about the iPad part being a much larger size.

I’m not sure why it wouldn’t detect iPod Touches, however you can get variables or prints out of your config.lua:

--In Config  
local width, height = 0, 0  
...  
  
print(width, height)  
--or  
\_G.configSettings = {width = width, height = height} --Then you can access these variables in main.lua to evaluate what went wrong by accessing configSettings.  
application =  
{  
...  
}  

That way you can see what the pixelHeight of his device is returning with as well as the path it takes. [import]uid: 134101 topic_id: 32730 reply_id: 130308[/import]

@egarayblas, good question and sorry to be hijaking your forum.

–> My problem is, how come the tall screen works on the iPhone 5 but not on the iPod Touch 5th gen?

PS: I have the same question in mind as you. BTW I always thought that if it is OK for the iPhone5 it surely would be OK for the iPod Touch 5th as well! o.O But as you are facing this weird problem right now and I do not own neither of these new iDevices so "How can I know if it will be OK for the iPod Touch 5th as well as the iPhone5? (Does Xcode have an iPod Touch 5th simulator and I do not know that?) o.O
Thanks,
Rodrigo.

[import]uid: 89165 topic_id: 32730 reply_id: 130309[/import]

@Ntero: No worries, your code is just fine and I think something’s up with Corona SDK here. That’s the thing, my friend, who has the iPod Touch lives on the other side of the globe and we just go via Testflight to test the builds. I’ll try and send him a build that outputs all these info as my last option. I was refraining from “bothering” him too much. :slight_smile:

@RSCDev: You’re not hi-jacking anything, the more people who respond, the faster we can figure this out. :slight_smile: Same here, I bought an iPhone 5 thinking that whatever runs on it will run on an iPod Touch 5th gen too, only to find out this issue.

Anyone who has an iPod Touch (5th gen) who can give this a try? I’d greatly appreciate it. :slight_smile: [import]uid: 44127 topic_id: 32730 reply_id: 130310[/import]

The reason for the % is a sort of consistency/safety. It makes sense on the iPad for detecting Retina/non-retina, but for iOS Tall it’s more of a ‘just-in-case’ they come out with a non-retina tall screen (not likely). So it’s probably a non-issue if you replace % 568 == 0 with == 1136.

And yeah I wrote it off the top of my head, sorry about the iPad part being a much larger size.

I’m not sure why it wouldn’t detect iPod Touches, however you can get variables or prints out of your config.lua:

--In Config  
local width, height = 0, 0  
...  
  
print(width, height)  
--or  
\_G.configSettings = {width = width, height = height} --Then you can access these variables in main.lua to evaluate what went wrong by accessing configSettings.  
application =  
{  
...  
}  

That way you can see what the pixelHeight of his device is returning with as well as the path it takes. [import]uid: 134101 topic_id: 32730 reply_id: 130308[/import]

@egarayblas, good question and sorry to be hijaking your forum.

–> My problem is, how come the tall screen works on the iPhone 5 but not on the iPod Touch 5th gen?

PS: I have the same question in mind as you. BTW I always thought that if it is OK for the iPhone5 it surely would be OK for the iPod Touch 5th as well! o.O But as you are facing this weird problem right now and I do not own neither of these new iDevices so "How can I know if it will be OK for the iPod Touch 5th as well as the iPhone5? (Does Xcode have an iPod Touch 5th simulator and I do not know that?) o.O
Thanks,
Rodrigo.

[import]uid: 89165 topic_id: 32730 reply_id: 130309[/import]

@Ntero: No worries, your code is just fine and I think something’s up with Corona SDK here. That’s the thing, my friend, who has the iPod Touch lives on the other side of the globe and we just go via Testflight to test the builds. I’ll try and send him a build that outputs all these info as my last option. I was refraining from “bothering” him too much. :slight_smile:

@RSCDev: You’re not hi-jacking anything, the more people who respond, the faster we can figure this out. :slight_smile: Same here, I bought an iPhone 5 thinking that whatever runs on it will run on an iPod Touch 5th gen too, only to find out this issue.

Anyone who has an iPod Touch (5th gen) who can give this a try? I’d greatly appreciate it. :slight_smile: [import]uid: 44127 topic_id: 32730 reply_id: 130310[/import]

FWIW, this is what iPod Touch 5G returns:

display.pixelHeight = 1136
display.pixelWidth = 640
thisDevice = iPod touch

So, when using system.getInfo( “model” ), I guess “iPod Touch” won’t work, but “iPod touch” would.

I don’t understand why @Ntero’s config.lua didn’t work, though. As @egarayblas noted, it could be a bug somewhere, but it’s just hard to imagine how it can be…

Naomi

[import]uid: 67217 topic_id: 32730 reply_id: 130319[/import]

FWIW, this is what iPod Touch 5G returns:

display.pixelHeight = 1136
display.pixelWidth = 640
thisDevice = iPod touch

So, when using system.getInfo( “model” ), I guess “iPod Touch” won’t work, but “iPod touch” would.

I don’t understand why @Ntero’s config.lua didn’t work, though. As @egarayblas noted, it could be a bug somewhere, but it’s just hard to imagine how it can be…

Naomi

[import]uid: 67217 topic_id: 32730 reply_id: 130319[/import]

Thank you so much for all the help guys!

Looks like my only option now is to get a 5th gen iPod Touch so I can figure this out and find the culprit. :S [import]uid: 44127 topic_id: 32730 reply_id: 130447[/import]

Thank you so much for all the help guys!

Looks like my only option now is to get a 5th gen iPod Touch so I can figure this out and find the culprit. :S [import]uid: 44127 topic_id: 32730 reply_id: 130447[/import]

@egarayblas, if you really get one and find out what the matter here about the iPod Touch 5th please tell me here mate.
Thanks in advance,
Rodrigo Costa.
@RSCdev [import]uid: 89165 topic_id: 32730 reply_id: 130465[/import]

@egarayblas, if you really get one and find out what the matter here about the iPod Touch 5th please tell me here mate.
Thanks in advance,
Rodrigo Costa.
@RSCdev [import]uid: 89165 topic_id: 32730 reply_id: 130465[/import]