Cocos2d-x 3.0 修改安裝程式名、更改預設表徵圖、修改螢幕方向、修改版本號碼,一些需要注意的問題,cocos2d-x3.0

來源:互聯網
上載者:User

Cocos2d-x 3.0 修改安裝程式名、更改預設表徵圖、修改螢幕方向、修改版本號碼,一些需要注意的問題,cocos2d-x3.0

很多新手程式猿做出一個遊戲後,編譯成apk安裝在手機上,缺發現安裝程式名和遊戲表徵圖都是Cocos2dx預設的,而且預設螢幕方向是橫向,那麼需要怎麼修改為自己想要的呢?

開啟你建立的工程-找到proj.android,找到AndroidManifest.xml並編輯:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
      package="com.Irvingrain.hellocpp"
      android:versionCode="1"

//這裡已經給我們提示當前程式的版本號碼。
      android:versionName="1"

//這裡已經給我們提示當前程式的版本名稱,例如1.1、1.2,如果需要修改遊戲版本可以修改這個值。

      android:installLocation="auto">


    <uses-sdk android:minSdkVersion="9"/>
    <uses-feature android:glEsVersion="0x00020000" />


    <application android:label="@string/app_name"//這裡已經給我們提示:@string/app_name說明在string.xml定義了app_name標籤
                 android:icon="@drawable/icon">
 
        <!-- Tell Cocos2dxActivity the name of our .so -->
        <meta-data android:name="android.app.lib_name"
             android:value="cocos2dcpp" />


        <activity android:name="org.cocos2dx.cpp.AppActivity"
                  android:label="@string/app_name"   
                  android:screenOrientation="landscape"
                  android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
                  android:configChanges="orientation">


            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>


    <supports-screens android:anyDensity="true"
                      android:smallScreens="true"
                      android:normalScreens="true"
                      android:largeScreens="true"
                      android:xlargeScreens="true"/>


    <uses-permission android:name="android.permission.INTERNET"/>
    <!--uses-permission android:name="android.permission.WAKE_LOCK" 禁止手機休眠/-->
</manifest> 

1.修改程式名:開啟proj.android\res\values下,string.xml

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <string name="app_name">程式名</string>
</resources>

//如果安裝遊戲後出現遊戲中文名亂碼,估計是你這個string.xml的編碼有問題,建議用EditPlus把這個檔案編碼更改為UTF-8後覆蓋。

2.修改遊戲表徵圖:

開啟 proj.android/res,這個檔案夾下面有三個檔案夾drawable-hdpi、drawable-mdpi、drawable-ldpi,

將自己要修改成的表徵圖按原來的像素製作好後覆蓋,如果安裝到手機表徵圖還是沒有改變,那個估計是之前留下的緩衝,

建議卸載遊戲後先清理系統垃圾和快取檔案再重新安裝,即可解決。

3.修改螢幕的方向:修改上面的AndroidManifest.xml,找到android:screenOrientation:

預設是橫屏landscape,豎屏是portrait。

4.修改遊戲版本號碼:修改上面的AndroidManifest.xml,找到android:versionName="1",

修改這個數值,如(1.1、1.2)

對應如果android:versionName="2",建議android:versionCode="2"

著作權聲明:本文為博主原創文章,未經博主允許不得轉載。

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.