如何在Cocos2D-JS 3.0中设置视口方向?

我发现了变量

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

在ccinputmanager.js中但没有函数实际设置它们。

我发现了这个描述:

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

但它对于Android和iOS是不同的,并且与Cocos Run命令相矛盾。

有帮助吗?

解决方案

在Android中只编辑文件

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

在项目目录中。改变

android:screenOrientation="landscape"
.

android:screenOrientation="portrait"
.

其他提示

您可以在项目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
},
.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top