Intel XDK - orientation problems

0 favourites
From the Asset Store
For problem solving, puzzles, bubbles, platforms and other adventures.
  • Hi everyone,

    Could anyone give me a quick run-down on how to lock orientation to landscape when exporting using Intel XDK. I've the project properties to landscape in C2 and edited the build settings - orientation in Intel XDK however it still doesn't lock to landscape.

    I've also tried experimenting with inputting the following into my Index.html file however I'm not really sure where to put it or even if I'm inputting the right thing:

    intel.xdk.device.setRotateOrientation("portrait");

    intel.xdk.device.setAutoRotate(false);

    intel.xdk.device.hideSplashScreen();

    Any help would be much appreciated!

    Kind Regards,

    Vega

  • intel.xdk.device.setRotateOrientation("portrait")?

    Why "potrait"?

  • intel.xdk.device.setRotateOrientation("portrait");

    be sure when you compile your game with XDK to change the settings for orientation, the old version its easier to use, the new one its kinda weird.

    even though you made the changes in your Capx project to landscape or portrait, before you compile, you need to go to Intel XDK project settings, and change game orientation, any settings that you change in Intel XDK will overwrite your Capx project settings.

  • Thanks for the reply guys.

    BouncyTrip

    Sorry I was just messing around with it to see if it did anything. I've tried both landscape and portrait and either way it doesn't lock.

    As specified in the original post, I've changed the project settings in intel XDK.

    Any other suggestions?

  • That's so strange...

    Have you set "Landscape" to the Crosswalk Build as in the image?

    [attachment=0:17lvfu2e][/attachment:17lvfu2e]

    Select the crosswalk build only.

    Also, have you updated XDK to the 1816 version?

  • BouncyTrip

    Thank you so much for taking the time to help me out.

    My Intel XDK version is 1816. I hadn't touched the android/crosswalk or windows options yet as I'm mainly trying to get it to work on my iPad at the moment. Tried setting the orientation option on the crosswalk build settings to landscape today and I'm still able to rotate the orientation on my iPad. The iOS build settings are obviously also set to landscape.

    I wonder if my problem has to do with where in the index.html file I input the code. I've tried multiple things. Any chance you could give me a hand?

    Here's two screenshots of my index.html file:

  • I know little about coding, but Index seems to lack of a line that specifies to set the game on landscape...

    May I ask you some questions?

    1- Have you checked if the config file inside your exported project folder specifies the landscape mode? (mine is potrait)

    [attachment=0:snjh2gvl][/attachment:snjh2gvl]

    2- When importing your project to Intel XDK, do you choose Yes to both the questions at this popup window?

    [attachment=2:snjh2gvl][/attachment:snjh2gvl]

    3 When exporting, do you specify the supported devices as universal? Is your iPad running iOS8?

    [attachment=1:snjh2gvl][/attachment:snjh2gvl]

    Also, have you tried to export without minifying?

    I hope it will help

  • BouncyTrip

    1 - My config file does specify landscape.

    2 - I can't remember what I specified for 'hybrid app project'. Game project however was set to yes. What does hybrid app project do?

    3 - Supported devices is set to universal, I'm running on iOS 8.

    And I'm also exporting without minifying.

    The index file I showed you in my last post was my basic code, not including the line which is supposed to lock the orientation. I have however tried adding this line in various different places. I found the appropriate code my searching Intel XDK forums online. The line is:

    document.addEventListener("intel.xdk.device.ready", onDeviceReady, false);

    function onDeviceReady(){

    intel.xdk.device.setRotateOrientation('landscape');

    intel.xdk.device.setAutoRotate(false);

    intel.xdk.device.hideSplashScreen();

    }

    Is this the correct line to input? Where in my above code should it go?

    Thanks again for helping!

  • Sorry but I can't help you with code

    The only thing I can suggest is to delete the actual exported project folder, create a new cordova minified export, set "Yes" to hybrid app project when importing to xdk, keep the "device" plugins always active, and as usual set the orientation to landscape in construct and in xdk...

    Let me know if it works

  • BouncyTrip

    Tried redoing the whole game and still no luck. Good news is in the end I paid the $25 and downloaded cranberrygame's plugins and it worked straight away

    The description on this particular plugin says "fixes screen orientation bug in iOS" so I'm guessing its a common problem. Thanks for all the help though!

  • I am so glad to know you have solved this problem

  • what is the name of the plugin?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Hmm

  • It's called PhonegapScreenOrientationLandscape and it's part of his collection. Bit of a shame that C2 can't do this without having to pay for extra plugins but anyways. Once you've got the plugin you just make sure it's installed correctly and that everything says landscape including you Intel XDK settings. Let me know if you run into any problems

  • I added it and working. Thanks.

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