- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
I am playing with iXDK and using integrated Cocos2D engine to create Android, iOS and Win applications/games. I posted a question in title on Cocos forums (http://discuss.cocos2d-x.org/t/how-to-disable-screen-orientation-change/27048) and received a following reply:
To disable orientation changes:
- on iOS in xCode go to ProjectSettings -> General Tab, here you can find 'Device orientation' settings.
Or you can directly modify Info.plist:
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
</array>
- on android find AndroidManifest.xml and add/edit next properties for main activity (android:screenOrientation & android:configChanges)
<activity
android:name="org.cocos2dx.cpp.AppActivity"
android:screenOrientation="portrait"
android:configChanges="orientation|keyboardHidden|screenSize"
android:label="@string/app_name"
android:theme="@android:style/Theme.NoTitleBar.Fullscreen" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
How do I implement these changes using Intel XDK and is this correct way to handle this problem?
I already used Build settings in Project tab, to set orientation on all platforms but this did not have a desired effect. I use Android (no Crosswalk) and iOS build options.
- Tags:
- HTML5
- Intel® XDK
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
setting orientation=portrait in build settings will lock the orientation when you build and install the app, let me know if this is not working, please send me the apk
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Setting orientation=portrait in Intel XDK build settings will do the same changes in info.plist and androidmanifest.xml.
Check your cocos2d game setup:
cc.view.setDesignResolutionSize(width, height, cc.ResolutionPolicy.SHOW_ALL);
cc.view.resizeWithBrowserSize(true);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I agree there might be a problem in my code but I created Landscape HTML+Cordova game from templates. It works as expected in emulator. Then I went to project options and changed all to portrait (all 4) but application did not change to portrait. I tried changing port./land. options for current project as well, but it did not change anything in emulator.
So port./land. setting works on initial creation of project but not on subsequent changes or is anything needed to apply those changes?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
if u notice the portrait and landscape cocos2d templates, it has different width and height values, you have to change that depending on the orientation:
cc.view.setDesignResolutionSize(width, height, cc.ResolutionPolicy.SHOW_ALL);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
This did solve the problem of changing resolution but my original question was (as in title) how to disable orientation change when rotating device that causes applications graphics screen to change dimensions. Meaning I would like my game screen to stay exactly the same as before rotation of device. Is this possible and if it is, how is it done?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
setting orientation=portrait in build settings will lock the orientation when you build and install the app, let me know if this is not working, please send me the apk
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Tank you for your answers, they helped reveal the problem.
It is true I did not test apk file at all, just emulator and weinre test over wireless. However both emulator and weinre will rotate screen unlike apk application. apk file was installed on to a same device as weinre, no changes were made to source code or settings between tests.
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page