why is "_3" image not being selected for scaling here? (code attached)

Any ideas why the “_3” image not being selected for scaling here when I switch the simulator to iPad Retina. Note that:

* when I run on iPhone mode I get the correct image (the version with no extension)
* when I run on iPhone Retina I get the correct image (the _2 version)
* when I run on iPad Retine I get the base image, and not the _3 version as I would have expected
* I the three images in the same directory

-rw-r--r--@ 1 rfr staff 294853 20 Jun 17:40 darkRoom.png  
-rw-r--r--@ 1 rfr staff 1177687 22 Jun 14:49 darkRoom\_2.png  
-rw-r--r--@ 1 rfr staff 4223822 21 Jun 17:22 darkRoom\_3.png  

Main.lua

-- Display Setup  
display.setStatusBar( display.HiddenStatusBar )  
  
print("scaling factors:", 1/display.contentScaleX, 1/display.contentScaleY)  
  
local dummyImage = display.newImageRect("darkRoom.png", 2048, 1408)  
dummyImage:setReferencePoint(display.TopLeftReferencePoint)  
dummyImage.x, dummyImage.y = 0,0  

Console Output (when run for iPad Retina)

scaling factors: 1 1  

config.lua

application =  
{  
 content =  
 {  
 width = 1408,   
 height = 2048,  
 scale = "letterbox",  
 xAlign = "center",  
 yAlign = "center",  
  
 imageSuffix =  
 {  
 [""] = 0.2,   
 ["\_2"] = 0.4,   
 ["\_3"] = 0.9   
 }  
  
 }  
  
  
}  

build.settings

[code]
settings = {

orientation = {
default = “landscape”,
supported =
{
“landscape”
},
},
}
[/code] [import]uid: 140210 topic_id: 27912 reply_id: 327912[/import]

Hi Greg,

This looks very familiar! :slight_smile: It’s basically the same issue that I dealt with last week. In the latest Corona build (or several daily builds back, I’m not sure), if the scale factor is exactly 1, then Corona will “default” to the non-suffixed version.

So, in your test, the iPad Retina spits out X/Y scale factors “1,1”. While it seems logical that it would pick “_3”… because 1 >= 0.9… it actually defaults to the “” (0.2) version.

Oddly, if you tweaked your width and height values slightly so that the Retina scale output was 0.99999, it would choose “_3”. Apparently it all revolves around the value being exactly 1, in which case it will default to the non-suffized set :frowning:

Anyway, to solve this, you can either keep your width and height setting the same (for Retina with the 2048 value) and then make your “base” image set the very largest ones (those designed for the Retina iPad). Your lower-size brackets would then be “_1” and “_2”, while the upper limit would be just “”.

I hope I described this without confusing you further. Basically, whatever device spits out scale values of 1, you need to make that image set be the “base” set, because Corona will choose that.

Brent

[import]uid: 9747 topic_id: 27912 reply_id: 113134[/import]

ok - thanks for the tip Brent

I’m actually now looking to move back to the reference size being the smallest - this was mainly due to this issue I was having here https://developer.anscamobile.com/forum/2012/06/25/widgetcandy-radiobutton-fontsize-vs-scale-dilema-do-i-need-use-small-reference-size

I’ll see if this just resolves it after I’ve finished this, or if I have to do the work around… [import]uid: 140210 topic_id: 27912 reply_id: 113135[/import]