Say I have following simple code, where I try to render some tiles and add a handler to allow user to pan the map.

config.lua
-- config.lua application = { content = { scale = 'adaptive' , fps = 60 } }
main.lua
-- main.lua -- save some screen space display.setStatusBar(display.HiddenStatusBar) -- we are mostly dealing with pixel asset display.setDefault('minTextureFilter', 'nearest') display.setDefault('magTextureFilter', 'nearest') --display.setDefault('isImageSheetSampledInsideFrame', true) -- use top-left origin display.setDefault('anchorX', 0) display.setDefault('anchorY', 0) local sheet1 = graphics.newImageSheet('tilesets-classic/internal-01.png', { width = 32 , height = 32 , numFrames = 192 }) local sheet2 = graphics.newImageSheet('tilesets-classic/internal-02.png', { width = 32 , height = 32 , numFrames = 168 }) local ts = 32 local tiles = {} local tile local view = display.newContainer(display.contentWidth, display.contentWidth) view.anchorChildren = false local group = display.newGroup() local group1 = display.newGroup() for y = 0, 100 do for x = 0, 100 do tile = display.newImage(sheet1, 49, x \* ts, y \* ts) group1:insert(tile) end end local group2 = display.newGroup() for y = 0, 10, 3 do for x = 0, 10, 3 do tile = display.newImage(sheet2, 25, x \* ts, y \* ts) group2:insert(tile) end end group:insert(group1) group:insert(group2) view:insert(group) local camera\_panning = false local ox, oy function touch (event) if event.phase == 'began' then -- enter panning state camera\_panning = true ox = group.x oy = group.y elseif event.phase == 'moved' and camera\_panning == true then -- distance of movement from initial position group.x = math.floor(ox + event.x - event.xStart) group.y = math.floor(oy + event.y - event.yStart) elseif event.phase == 'ended' or event.phase == 'cancalled' then -- exit panning state camera\_panning = false end end Runtime:addEventListener('touch', touch)
There is a problem I only experience on iOS (iPhone 6) but not in the Corona SDK Simulator: when I pan the map, on certain position, each tile’s edge can appears slightly thinner than usual; the symptom repeats for every a few pixels.
I have tried a few solutions:
-
Extruding / Additional margins between tiles
-
Normalize the movement to integer (so no subpixel positioning)
- isImageSheetSampledInsideFrame = true
The first 2 doesn’t solve the issues; the last one solve it by introducing another problem (half-pixel edge, so we always have thin edges, that’s also undesirable, as described here).
What’s the best way to fix this? Why can we only reproduce it on real device? (probably screen related, nonetheless very annoying, because we have to re-build for each attempts to fix it)
