contentWidth VS actualContentWidth

my config lua file :

it gives modes = 2 and _w,_h=360,640

if not display then return end local w, h = display.pixelWidth, display.pixelHeight local modes = {1, 1.5, 2, 3, 4, 6, 8} -- Scaling factors to try local contentW, contentH = 320, 480 &nbsp; -- Minimal size your content can fit in -- Try each mode and find the best one local \_w, \_h, \_m = w, h, 1 for i = 1, #modes do &nbsp; &nbsp; local m = modes[i] &nbsp; &nbsp; local lw, lh = w / m, h / m &nbsp; &nbsp; if lw \< contentW or lh \< contentH then &nbsp; &nbsp; &nbsp; &nbsp; break &nbsp; &nbsp; else &nbsp; &nbsp; &nbsp; &nbsp; \_w, \_h, \_m = lw, lh, m &nbsp; &nbsp; end end -- If scaling is not pixel perfect (between 1 and 2) - use letterbox if \_m \< 2 then &nbsp; &nbsp; local scale = math.max(contentW / w, contentH / h) &nbsp; &nbsp; \_w, \_h = w \* scale, h \* scale end application = { &nbsp; &nbsp; content = { &nbsp; &nbsp; &nbsp; &nbsp; width = \_w, &nbsp; &nbsp; &nbsp; &nbsp; height = \_h, &nbsp; &nbsp; &nbsp; &nbsp; scale = 'letterbox', &nbsp; &nbsp; &nbsp; &nbsp; fps = 30, &nbsp; &nbsp; &nbsp; &nbsp; imageSuffix = { &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ['@2x'] = 1.1, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ['@4x'] = 2.1, &nbsp; &nbsp; &nbsp; &nbsp; } &nbsp; &nbsp; } } -- Uncomment to use the common content scaling --[[application = { &nbsp; &nbsp; content = { &nbsp; &nbsp; &nbsp; &nbsp; width = 320, &nbsp; &nbsp; &nbsp; &nbsp; height = 480, &nbsp; &nbsp; &nbsp; &nbsp; scale = 'letterbox', &nbsp; &nbsp; &nbsp; &nbsp; fps = 60, &nbsp; &nbsp; &nbsp; &nbsp; imageSuffix = { &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ['@2x'] = 1.1, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ['@4x'] = 2.1, &nbsp; &nbsp; &nbsp; &nbsp; } &nbsp; &nbsp; } } --]]

Lerg’s config.lua attempts to make sure display.contentWidth = display.actualContentWidth and display.contentHeight = display.actualContentHeight. So your contentWidth should be 640, though he does some magic math on trying to remain pixel perfect and that could affect the width in some how. And I think that’s what’s causing you to come up 48 pixels short with your content area.

Rob

@yvandotet,

If you are trying to better understand how to determine the edges of the screen please see this example:

https://github.com/roaminggamer/RG_FreeStuff/tree/master/AskEd/2015/10/lgg4

(From my multi-year repository of forums answers)

lgg4.png