Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

supportedOrientations(LANDSCAPE_ANY) not working?

Hi there,

I'm working on a game app which only should use supportedOrientations(LANDSCAPE_ANY) but when I turn my iPad Air2 (iOS 8.x up to latest 9.2.1, Codea: 2.? up to current 2.3.2(61)), it still shows portrait mode when turning the device (while running inside Codea IDE on iOS).

Like said in http://twolivesleft.com/Codea/Reference/Display.html#supportedOrientations, I put supportedOrientations(LANDSCAPE_ANY) before setup() in # Main - tab.

Appreciate any enlightenment :D

Have a great WE

Heiko

Comments

  • Posts: 2,020

    Weird, it works for me on iPad Air 1. And the command is definitely outside of any function? Eg

    --# Main
    displayMode(OVERLAY)
    
    supportedOrientations(LANDSCAPE_ANY)
    function setup()
    
  • @yojimbo2000: Thanks for your endeavour.

    Yes, supportedOrientations(LANDSCAPE_ANY) is outside any function, but below some global dev-vars.
    It's located like:

    --# Main
    
    -- Developer Info:
    App_Version =       "0.00.d032"
    App_ModDate =       "2016-01-19"
    App_Author =        "HeiKoDea"
    ...(some more vars like above)
    
    -- Setup display functions:
    supportedOrientations(LANDSCAPE_ANY)
    
    function setup()
    ...
    

    Also, while not much aware of displayMode(OVERLAY), I tried to put this in front of supportedOrientations(LANDSCAPE_ANY) but with no success.

    Anyway, thanks for your time Sir,

    Heiko

  • Posts: 2,020

    Anyone else with an iPad Air 2 had this issue? That's the only difference I can see between @HeiKoDea 's setup and mine.

  • @yojimbo2000:

    Yap, iPad Air1/2 seems to be the only obvious difference, but...

    I used any (reliable) search-engine: Found nothing adequate.
    I used all available neurons: No success.
    I agreed with myself, that I did something wrong.

    Anyone who can enlighten my lonesome life? :neutral:

    Just joking,

    Heiko

  • dave1707dave1707 Mod
    Posts: 8,178

    @HeiKoDea Try running this and see if it stays in LANDSCAPE_ANY mode as you rotate the iPad. It's good to try the least amount of code to track down a problem. This works on my Ipad Air.

    supportedOrientations(LANDSCAPE_ANY)
    displayMode(FULLSCREEN)
    
    function setup()
    end
    
    function draw()
        background(255)
        sprite("Cargo Bot:Cargo Bot Title",WIDTH/2,HEIGHT/2)
    end
    
  • IgnatzIgnatz Mod
    Posts: 5,396

    Both the original example and dave's work fine on my Air 2

  • Posts: 2,020

    Do you call supportedOrientations in any other part of the code, or any dependency? (Though dependency is compiled first I think, so would be overridden)

  • @dave1707: Thanks for your suggestion.

    Of course, "It's good to try the least amount of code to track down a problem" is the way to go and I learned this since the seventies when I started to develop software for my in-house needs. (And my brain)

    supportedOrientations(LANDSCAPE_ANY) just never worked over here. Neither on iOS 8.x up to latest 9.2.1, Codea: 2.? up to current 2.3.2(61) as mentioned in my OP.

    Whatever the reason is, I took countless hours to understand (and I should be able after learning 25+ langs in my life - Sorry for my arrogance) without a solution to this prop.

    However, thanks Dave,

    Heiko

  • edited January 2016 Posts: 502

    It works for me on iPad Pro..
    But have you tried supportedOrientations(LANDSCAPE_LEFT, LANDSCAPE_RIGHT) ?

    Edit: you could also try to (re-)set it inside function orientationChanged() supportedOrientations(LANDSCAPE_LEFT, LANDSCAPE_RIGHT) end

  • @se24vad:

    While I'm jealous you got an iPad Pro :), nope:

    supportedOrientations(LANDSCAPE_LEFT, LANDSCAPE_RIGHT) didn't work neither. (tested right away and previously also)

    But thanks for chiming in and taking your time,

    Heiko

    PS: Sorry for my english, it's not my native language.

  • edited January 2016 Posts: 502

    can you pm/send me your code? so I can test it properly?

    Edit: Yeah ^.^ I'm happy to have it - the bigger screen alone was worth they buy - but I actually got it because of the pencil ... still, all this is very costly :(

  • Whup, this wend to fast in the midnight over her for me. Sorry for late response.

    @Ignatz: "Both the original example and dave's work fine on my Air 2" - Will dig deeper. Thanks!

    @yojimbo2000: No, I don't: "call supportedOrientations in any other part of the code, or any dependency". Thanks for your qualified question anyhow.

    I'm very grateful for all your fellow (no girls around?) efforts.

    From my point of view, I'm just using a command which never worked to me. At the other hand it "just works" for the rest of the "Codea World"

    Makes me lost and I'm very thankful of more ideas.

    Thank you,

    Heiko

  • IgnatzIgnatz Mod
    Posts: 5,396

    The important thing is that it's likely to work on other peoples' iPads

  • @se24vad:
    "can you pm/send me your code? so I can test it properly?"

    Would love to send it to you for proper testing but it's about some 10k lines now, plus loads of 3d/2d graphics, worth of not an unessential part of my life and intentions I'm working on since a year in my spare time. (My usual 24/7 job is being the owner of a filmmakers agency. Well, life is strange. PM me for further communications if you like)

    Thanks for trying to help,

    Heiko

  • @Ignatz: "The important thing is that it's likely to work on other peoples' iPads"

    You're right and exactly this is what makes me feel like a honk.
    Have no glue.

    Thanks Ignatz,

    Heiko

  • dave1707dave1707 Mod
    Posts: 8,178

    @HeiKoDea Is your iPad laying flat or are you holding it vertically as you rotate it.

  • @dave1707:

    My dev iPad Air2 usually stands landscape in an Otter-Box. The app I'm creating makes only sense and is designed for landscape. If I turn this device, it rotates the view canvas, even I locked rotating with supportedOrientations(LANDSCAPE_ANY).

    Don't want to be a dude but this game has now over 10k lines of code working perfect, except supportedOrientations(LANDSCAPE_ANY) just doesn't work as claimed and expected.

    Any voodoo experienced around?

    However, thanks for your question Dave,

    Heiko

  • dave1707dave1707 Mod
    Posts: 8,178

    @HeiKoDea Run this code and rotate your iPad. Does the value that shows match the value with the round home button in the 4 different positions.

    displayMode(FULLSCREEN)
    
    function setup()
    end
    
    function draw()
        background(0)
        fill(255)
        text(str,WIDTH/2,HEIGHT/2+30)
        text("round home button on bottom =  0",WIDTH/2,HEIGHT/2-30)
        text("round home button on right  =  3",WIDTH/2,HEIGHT/2-60)
        text("round home button on top    =  1",WIDTH/2,HEIGHT/2-90)
        text("round home button on left =  2",WIDTH/2,HEIGHT/2-120)
    end
    
    function orientationChanged(orien)
        str=orien
    end
    
  • @dave1707:

    Thanks. Will try tomorrow - its now 4AM here and I finally have to throw my head on a pillow.

    I'll be back after some sleep, thanks to all fellows,

    Heiko

  • IgnatzIgnatz Mod
    Posts: 5,396

    Real programmers don't sleep! ;)

  • dave1707dave1707 Mod
    Posts: 8,178

    @HeiKoDea Are you using Codea Scratchpad. I seen in the documentation that supportedOrientations() isn't supported with Scratchpad.

  • Well I found out: When I start the project via Air Code, supportedOrientations doesn't work. Starting it right on iPad from Codea it works as expected.

    @Ignatz: Have to simulate sleeping for my wife only to prevent calling me zombiebabe all the time...

    @All: Thanks for your suggestions and time!

    Regards, Heiko

Sign In or Register to comment.