【问题标题】:cocos2d-js: How to set viewport orientation (landscape / portrait)?cocos2d-js:如何设置视口方向(横向/纵向)?
【发布时间】:2014-06-04 07:17:12
【问题描述】:

如何在 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 运行命令相矛盾。

【问题讨论】:

    标签: cocos2d-x cocos2d-x-3.0 cocos2d-js


    【解决方案1】:

    在 Android 中只需编辑文件

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

    在项目目录中。改变

    android:screenOrientation="landscape"
    

    android:screenOrientation="portrait"
    

    【讨论】:

      【解决方案2】:

      你可以在你的项目 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
      },
      

      【讨论】:

        猜你喜欢
        • 2021-12-27
        • 1970-01-01
        • 2019-02-08
        • 1970-01-01
        • 1970-01-01
        • 2019-07-23
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多