1. I don't know why people still use 320x480. It has many issues, not the least of which is rounding problems. Better to go with 640x960
(The only thing this resolution has going for it is that 'in the head' calculations are easy if you are making a grid based game and use a grid size of 40 or 32, leading to grids of 8x12 or 10x15 respectively.)
2a. Your horizontal content space (480) will NOT fill the screen in letterbox mode and landscape orientation. There will be gaps on the left and right.
2b. The vertical content space (320), will be perfectly edge-to-edge fitting.
3. If we ignore the stupid notch (I hate that thing). The right way to create 8 shapes that will fill the width of the screen is:
-- original width and height of your art, whatever you made it.
local origWidth = 300
local origHeight = 40
-- calculate exact width for 8 blocks to fill screen
local targetWidth = display.actualContentWidth/8
-- Calculate new height as ratio of original width and new width multiplied by old height
-- We do this to maintain the original aspect ratio of the art.
local targetHeight = (targetWidth/origWidth) * origHeight
-- calculate left edge of screen
local curX = display.contentCenterX - display.actualContentWidth/2
-- choose y position
local curY = display.contentCenterY
-- place 8 blocks left to right, aligned to their left edges.
for i = 1, 8 do
local tmp = display.newImageRect( "img path", targetWidth, targetHeight )
tmp.anchorX = 0
tmp.x = curX
tmp.y = curY
curX = curX + targetWidth
This may still have gaps because you're using a tiny content resolution. Try it and find out.
Edited by roaminggamer, 10 May 2018 - 07:11 AM.