Check if mobile device screen is rotate

  • I'm sure this has been answered somewhere already so I'm sorry for asking again. What I'm looking for is to check if a mobile device has been rotated and the screens orientation has changed to be on the side. I know using a touch object I can check how far it's been turned left and right but that doesn't actually tell me if the screen has flipped.

    Is there any way to get the full window size rather than just the container that the game is in maybe? I thought about checking if windowWidh > windowHeight which would make me think the screen has been rotated but this doesn't work unfortunately.

    I'd imagine there would be some easy way to do this, unfortunately when ever I search for it all I'm finding is results on how to tell how far the device is turned rather than if the screen has actually changed orientation.

    Any help anyone is able to give me would be greatly appreciated, and sorry again for what I assume is a double post.

    Stevil

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • You can use the IntelXDK Event:

    IntelXDK : Compare orientation ( Landscape || Portrait ) => do sth.

  • Thanks Prox, I can't test it out at the moment but it looks exactly like what I've been looking for. I knew there would have been a simple way to do it.

    Appreciate the help!

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)