Can't get 2x image support working.. help please!

Reading the docs it says that different image sizes will kick in when display.pixelWidth / display.actualContentWidth is greater than or equal to the value of the value assigned to your image suffix. No matter what I’m doing display.actualContentWidth is printing out 0… making the value infinity… I’ve tried all kinds of diff projects and diff config.lua files but I’m having the same problem no matter what. Any ideas??

 -------------------------------------------------------------------------------- -- config.lua -------------------------------------------------------------------------------- print(display.pixelWidth) print(display.actualContentWidth) print( display.pixelWidth / display.actualContentWidth ) application = { content = { width = 768, height = 1024, scale = "letterbox", fps = 60, imageSuffix = { ["@2x"] = 1.5, } } }

Place the print statements in main.lua, not in config

You are trying to print these values before config.lua is even loaded.

ohh duh…  :slight_smile:

so seems to mostly be working now.  have a second question.  when i do print( display.pixelWidth / display.actualContentWidth ) I’m getting ~0.46.  I have my 2x value set to 0.8 and my 2x images are still being triggered.  once I set it to 0.9 then it reverts to 1x images.

shouldnt  pixelWidth/actualContentWidth  be greater than or equal to your 2x value in order to trigger scaled images?  it seems like it uses double the pixelWidth/actualContentWidth

Place the print statements in main.lua, not in config

You are trying to print these values before config.lua is even loaded.

ohh duh…  :slight_smile:

so seems to mostly be working now.  have a second question.  when i do print( display.pixelWidth / display.actualContentWidth ) I’m getting ~0.46.  I have my 2x value set to 0.8 and my 2x images are still being triggered.  once I set it to 0.9 then it reverts to 1x images.

shouldnt  pixelWidth/actualContentWidth  be greater than or equal to your 2x value in order to trigger scaled images?  it seems like it uses double the pixelWidth/actualContentWidth