2

How can I set the viewport orientation in cocos2d-js 3.0?

I found the variables

cc.UIInterfaceOrientationPortrait
cc.UIInterfaceOrientationLandscapeLeft
cc.UIInterfaceOrientationLandscapeRight
cc.UIInterfaceOrientationPortraitUpsideDown

in CCInputManager.js but no function to actually set them.

And I found this description:

http://www.cocos2d-x.org/wiki/Device_Orientation

but it is different for Android and iOS and that contradicts the cocos run command.

4

2 回答 2

1

In Android just edit the file

frameworks/runtime-src/proj.android/AndroidManifest.xml

in the project directory. Change

android:screenOrientation="landscape"

to

android:screenOrientation="portrait"
于 2014-06-04T12:56:33.277 回答
0

you can change in your project config.json

    {
     "init_cfg":{
    "isLandscape": false,
     "isPotrait":true,
     "isWindowTop": false,
     "name": "untitled",

    "width": 960,
    "height": 640,
   "entry": "main.js",
   "consolePort": 6050,
   "uploadPort": 6060,
   "debugPort": 5086
},
于 2015-05-10T14:49:49.223 回答