I was having difficulty using display.contentWidth and Height when trying to build a game today, so I decided to isolate the problem. I went ahead and created a main file with only the three lines of code below. I’m trying to make an image full screen but it seems that when I switch devices the image is either too short or not wide enough.
Main.lua
local grass = display.newImageRect("grass.png", display.contentWidth,display.contentHeight) grass.x = display.contentWidth/2 grass.y = display.contentHeight/2
Config.lua
application = { content = { width = 320, height = 480, scale = "letterBox", fps = 30, --[[imageSuffix = { ["@2x"] = 2, ["@4x"] = 4, }, --]] }, }
Screen shot of program being displayed on Iphone 5
What am I doing wrong?