Sim / Device Inconsistency: Screen Width & Config.lua

I am working on an app and have hit a brick wall so I’m throwing it out here to see if I get any insight/suggestions.

My app runs Landscape mode, build settings looks like:

settings = {  
 orientation =  
 {  
 default = "landscapeRight",  
 supported =  
 {  
 "landscapeRight",  
 "landscapeLeft"  
 },  
 },  

My config.lua looks like:

if system.getInfo("model") ~= "iPad" then  
 application =   
 {  
 content =  
 {  
 width = 640,  
 height = 960,  
 scale = "letterbox",  
 fps = 30  
 },  
 }  
else  
 application =   
 {  
 content =  
 {  
 width = 768,  
 height = 1024,  
 scale = "none",  
 fps = 30  
 },  
 }  
end  

I use:

local theDeviceIs = system.getInfo( "model" )  

to help determine which background images I want to display.

The problem: I have a slideshow of 11 960x640 JPG images that I show in one portion of my app and on the iPhone4 Sim skin it shows the images full screen (as desired). On the physical device, the images are showing up at what appears to be a scale of 0.5 yet I have confirmed that the scale being set is in fact p:scale(1,1)

Interesting Clues: If I set that scale to 2,2 the full screen images on the iPhone4 become full screen (although they slightly bleedover the display area and are slightly cutoff - which is interesting that it’s not a perfect fit). Also the display on the iPhone Sim shows them at scale 0.5 and in fact on a physical 3GS device it’s consistent with how it looks (ie 0.5 scale).

Inclination: My gut tells me somehow the device is scaling the display; now why it’s ONLY doing it on this portion of the app is unclear. I have several other screens including different functionality that all display FULL SCREEN on my iPad, iPhone4 devices and are consistent with what they look like on the Sim. It’s only this slideView picture code (that someone else gave me) that is having issues. It seems to be a system thing but I cannot for the life of me figure out why it thinks it has to shrink the images on the device while the iPhone4 Sim shows it properly. [import]uid: 74844 topic_id: 17726 reply_id: 317726[/import]

this sounds very similar to an issue I was having here:

https://developer.anscamobile.com/forum/2011/11/11/app-not-scaling-same-windows-vs-osx [import]uid: 49447 topic_id: 17726 reply_id: 67578[/import]

Am curious what html tags you’re using to display the images in your link? I’ve wanted to include images and am curious how you’re doing this. thanks. [import]uid: 74844 topic_id: 17726 reply_id: 67582[/import]

just the standard tags

[html]

[/html] [import]uid: 49447 topic_id: 17726 reply_id: 67585[/import]

Additional Note: You’ll see the “letterbox” setting in my config.lua which then allows the display to scale properly onto the 3GS device(s). Well, everywhere except the slideView.lua portion.

Here is a comparison of Sim against screen capture of iPhone4 device:

[import]uid: 74844 topic_id: 17726 reply_id: 67554[/import]

(thanks for the reminder on the img tag)

After reading thru your link, I don’t think they’re related… I mean, they could be similar in that the “sim” results is different from the actual device maybe? Although it sounded like your difference was more between Android vs. iOS?

Mine is a scaling issue, I’m like 98% sure of it. But on a system level. I say this because on our game we just released, we did a “scrolling credits” PNG that was very tall and the system scaled it down to try and make it fit the screen. We had to force the scale back to 1,1 to make it “normal” again. They may have nothing to do with one another, but there is nothing in the code that is changing the scaling of the images - so it has to be a system “behind-the-scenes” thing going on. Something is tricking the system into thinking the images are bigger than the display so it’s trying to scale it down to ensure it fits. I should try and make the images smaller than 960x640 and see what it does.

EDIT: I made the images smaller and the iPhone4 device still scales them way down.

NOTE: The iPhone & iPhone4 skin on my Windows system shows the images at full screen, whereas the iPhone skin on my Mac system shows the images at 0.5 scale (which correctly reflects what the actual iPhone4 device does).

iPhone4 Version 5.0.1
Mac SDK: 645
Win SDK: 591

Mac
iPhone Sim == iPhone4 Device == 3GS Device
iPhone4 Sim != iPhone4 Device

Win
iPhone Sim != iPhone4 Device
iPhone4 Sim != iPhone4 Device [import]uid: 74844 topic_id: 17726 reply_id: 67588[/import]

I think the issue for me is my config.lua with the imageSuffix @2x - I implemented Beebe’s Storyboard sample code and played around with this and found the imageSuffix to fix the “similar” problem I was getting.

I will attempt to put this into my code above and see what happens with the Sims and the Devices. I suspect this will fix my issue. Then I need to do more research on why this does what it does.

EDIT: After some careful code consideration, I believe the logic I employed for determining appropriately scaling of the images was being sabotaged by:

 local viewableScreenW, viewableScreenH = display.viewableContentWidth, display.viewableContentHeight  

It would appear that display.viewableContentWidth and display.viewableContentHeight return different values on the DEVICE vs. SIMULATOR. It must. That’s why I’m getting differing results between sim and devices. When I don’t depend upon logic that looks at these values, and force the scale(1,1) my images do what I would expect and they’re consistent across sim and devices. [import]uid: 74844 topic_id: 17726 reply_id: 67658[/import]