如何在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命令相矛盾。
答案 0 :(得分:1)
在Android中只需编辑文件
frameworks/runtime-src/proj.android/AndroidManifest.xml
在项目目录中。变化
android:screenOrientation="landscape"
到
android:screenOrientation="portrait"
答案 1 :(得分:0)
您可以更改项目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
},