@Bri_G I modified this on my iPhone to remove the simulated screen sizes. I’ll see what it looks like on my other devices.
It looked Ok on my iPad Air 3.
It looked Ok on my iPad Pro.
It looked Ok on my iPhone 8
So this code looked Ok on all 3 of my devices.
It’s a matter of scaling the sprite images, the text, the screen positions, ellipse sizes, touch positions, etc.
viewer.mode=FULLSCREEN
function setup()
img=readImage(asset.documents.Dropbox.Planetarium3)
iw=img.width
ih=img.height
stroke(255)
strokeWidth(2)
tab={vec2(200,100),vec2(900,100),vec2(200,600),vec2(900,600)}
sxRatio=WIDTH/1112
syRatio=HEIGHT/834
pl=nil
end
function draw()
background(0)
if WIDTH<HEIGHT then
text("Rotate device to lanscape, then restart",WIDTH/2,HEIGHT/2)
return
end
noFill()
rect(0,0,WIDTH,HEIGHT)
drawSprite()
drawText()
for a,b in pairs(tab) do
ellipse(b.x*sxRatio,b.y*syRatio,5)
end
if pl~=nil then
noFill()
ellipse(pl.x,pl.y,40*sxRatio,40*syRatio)
end
end
function drawSprite() -- draw sprite
if not hit then
sprite(img,WIDTH/2,HEIGHT/2,sxRatio*iw,syRatio*ih)
end
end
function drawText()
fill(255)
fontSize(20*sxRatio)
text("qwertyuiop",WIDTH/2,HEIGHT/2+300*syRatio)
text("asdfghjkl",WIDTH/2,HEIGHT/2+240*syRatio)
text("zxcvbnm",WIDTH/2,HEIGHT/2)
end
function touched(t)
if t.state==BEGAN then
hit=false
pl=nil
distX=58*sxRatio
distY=58*syRatio
if t.x>WIDTH/2-distX and t.x<WIDTH/2+distX and t.y>HEIGHT/2-distY-280*syRatio and t.y<HEIGHT/2+distY-280*syRatio then
hit=true
end
for a,b in pairs(tab) do
if t.x>b.x*sxRatio-30 and t.x<b.x*sxRatio+30 and t.y>b.y*syRatio-30 and t.y<b.y*syRatio+30 then
pl=vec2(b.x*sxRatio,b.y*syRatio)
end
end
end
if t.state==ENDED then
hit=false
end
end