The Final Frontier

@UberGoober - that’s just what I was thinking of doing, will update and repostmay take a little time.

@dave1707 needed to make some adjustments to your select galaxy routine to get the shading correct. See below:


viewer.mode=STANDARD
function setup()
    cx,cy=WIDTH/2,HEIGHT/2    
    nbr={3,2,1,8,7,6,5,4}
    turn = {-90,-45,0,45,90,135,180,225}
    pick = 1
    ang = 0
end

function draw()
    background()
    sprite(asset.documents.Planetarium3S,cx,cy)
    pushMatrix()
        translate(cx,cy)
        rotate(turn[nbr[pick]])
        sprite(asset.documents.Planetarium3M,0,0)
    popMatrix()
    output.clear()
    print("pick "..pick)
    print("angle "..turn[pick])
    print("ang "..ang)
end

function touched(touch)
    if touch.state==BEGAN then
        selectGalaxy(touch)
    end    
end

function selectGalaxy(gs)
    
    ang=math.deg(math.atan2(gs.y-cy,gs.x-cx))+22.5
    if ang<0 then
        ang=ang+360
    end
    pick=nbr[ang//45+1]
end

Will incorporate into the project and try to tidy up the other issues. Thanks.

@UberGoober - @dave1707 - updated the latest Elite Galaxies with the amended selector controls and tried to put in scaling factors for the different device resolutions. Please try out, I have only iPads at 1024/768 to check this on. Link below:

Updated Elite Galaxies

Thanks

@Bri_G I tried it on my iPad Air 3 and you still have to press just below the G to get the numbers. If you tap in the middle of the G, it just selects a planet.

@dave1707 - thanks for the feedback, is that in the same location as before the mods ? Has it scaled up otherwise and planets are selectable OK ?

It’s the same location as before, just below the G and the bottom of the circle. The planets are OK and end up in the center of the circle.

Tried it on my iPhone 8 and the G is too far down. I can’t tap below the G where I tap on the iPad Air so I can’t get to the number circle. The planets are Ok, but sometimes the info is over the planets after it’s selected.

@dave1707 @UberGoober - hmmmm, just looking at this I think I need a major re-write. The project was written for a standard iPad screen and thinking of other resolutions needs a step back. Writing for a broader audience needs a different approach. May take me a little time. Could be a lot of learning for me. Thanks.

@dave1707 @UberGoober - back again not totally tidied up but hopefully fixed some of the issues. Scaling should be OK now but I have no way to test it. Link below:

Elite Galaxies V3

Please check out and feed back issues/observations.

@Bri_G Things are worse. The text of the planet position extends way off the right side if the ( shield ? ) on one line. Lots of digits past the decimal point. Trying to get to the number circle is very hard. Not sure where the sweet spot is when touching the G. Also when tapping on a planet, the circle doesn’t always center on it. Sometimes it’s way off. This is on my iPad Air 3.

@dave1707 - thanks, good feedback. Firstly did the system operate to switch between landscape and portrait ? We’re there any changes with the image/planet positions (I mean obvious changes) ?
Any chance you could send me a screenshot ? By email probably best.
I scaled the text up in line with the image scaling which looks like the wrong thing to do. Need another algorithm for text.

Thanks for this.

@Bri_G Sent you a screen shot to your listed email address.

@dave1707 - thanks, thought it might be that - coordinates need flooring.

Thanks

@Bri_G Maybe this will help you test on different screen sizes. At the beginning of setup set newWidth=WIDTH and newHeight=HEIGHT. Then in your code change anywhere you have WIDTH or HEIGHT to newWidth or newHeight. Then if you want to see what your code looks like on a different sized screen, change the newWidth and newHeight to the screen values you want to try. Of course this would only work if the test screen size is less than your current screen size.

@Bri_G Heres something I wrote long ago to show sprites and text on different screen sizes. Tap the screen to cycle thru the different screen sizes.

viewer.mode=FULLSCREEN

function setup()  
    device={"iPad Pro","iPad Air","iPhone7 Plus",
            "iPhone7","iPhone 5","Watch 42mm","Watch 38mm"}
    rectMode(CENTER)
    fontSize(40)
    font("Baskerville-SemiBoldItalic")
    x,y=300,100
    xv,yv=3,3
    dev=1
    if WIDTH<HEIGHT then
        tab={vec2(1024,1366),vec2(768,1024),vec2(414,736),
                vec2(375,667),vec2(320,568),vec2(156,195),vec2(136,170)}
    else
        tab={vec2(1366,1024),vec2(1024,768),vec2(736,414),
                vec2(667,375),vec2(568,320),vec2(195,156),vec2(170,136)}
    end 
    currW=WIDTH
    currH=HEIGHT 
end

function orientationChanged()
    setup()
end

function draw()
    background(0)
    fill(255)   
    stroke(255)
    strokeWidth(3)

    -- same code for all devices
    w=tab[dev].x    -- width of device from table
    h=tab[dev].y    -- height of device from table
    ar=(w/h)/(currW/currH)    -- aspect ratio
    scale(w/currW,h/currH)    -- scale of device to largest screen

    sprite(asset.builtin.Planet_Cute.Character_Pink_Girl,x,y,101,171*ar)
    sprite(asset.builtin.Planet_Cute.Character_Cat_Girl,100,600,101,171*ar)

    text("Tap screen to show different sizes.",currW*.45,currH*.25)
    text(device[dev],currW*.2,currH*.45)
    text(tab[dev].x.."  "..tab[dev].y,currW*.2,currH*.4)

    noFill()
    ellipse(currW/2,currH/2,50,50*ar)
    ellipse(currW*.75,currH*.75,100,100*ar)

    line(currW/2,currH/2,0,currH)
    line(currW*.75,currH*.75,200,100)

    rect(currW/2,currH/2,currW,currH)
    rect(200,100,100,100*ar)
    -- end of same code for all devices

    -- calculate motion of sprite
    x=x+xv
    y=y+yv
    if x>=currW or x<=0 then
        xv=-xv
    end
    if y>=currH or y<=0 then
        yv=-yv
    end    
end

function touched(t) -- display different device size
    if t.state==BEGAN then
        dev=dev+1
        if dev>#device then
            dev=1
        end
    end
end

@Bri_G I changed your code to do what I mentioned above with the WIDTH and HEIGHT. I set the width to 1024 and the height to 768 which I think is the screen size of the iPad Air 1. I ran you code and everything was right on. Tapping a planet put it exactly in the center of the circle. The position text on the shield was correct and didn’t extend past the edge. And tapping anywhere in the G circle always took me to the number circle. So it looks like your program is setup for 1024x768.

When I keyed in my iPad Air 3 values, 1112x834, things were messed up.

@dave1707 - I tried your suggestion and as you say I got some weird effects. I’ve already resolved a couple of problems but trying to emulate scale gave even more. Here’s my latest amended version 3.

Elite Galaxies V3 amended

Thanks again

@Bri_G Tried this on my iPad Pro 1 and it’s really messed up. If I tap on a planet, the circle shows up around some other planet. Tapping anywhere on the G doesn’t take me to the number circle. Plus, some of the info on the shield isn’t right.

@Bri_G I changed your code on my air pro to what I did before and set it to 1024x768 and everything was OK. So you need to figure out how to adjust your code for different sizes.

@dave1707 - thanks again, looking at my recent attempts to scale this I think I need to step back and rebuild. Most of the code is OK - thin I 've been scaling too often. Back to first principles. Thanks again.