Cocos2d-x移植Android 常見問題處理辦法

來源:互聯網
上載者:User

標籤:des   android   c   style   class   blog   

1、函數、變數出現“could not be resolved ”問題

出現此問題一般是沒有找到cocos2d-x聲明的標頭檔,在eclipse將cocos2d的標頭檔目錄引入,包括工程目錄、platform/android

在hellocpp/main.cpp函數加入標頭檔

#include "AppDelegate.h"#include "cocos2d.h"#include "CCEventType.h"#include "platform/android/jni/JniHelper.h"#include <jni.h>#include <android/log.h>#include "CCEGLView.h"#include "CCApplication.h"


 2、去掉螢幕左下角三行數字

三行數位說明:

第一行當前情境的渲染批次

第二行渲染每一幀需要的時間

第三行是FPS

在AppDelegate.cpp檔案applicationDidFinishLaunching()找到下列行修改為false即可

    pDirector->setDisplayStats(false);

 

3、移植android,遊戲自適應手機螢幕

在AppDelegate.cpp檔案applicationDidFinishLaunching()函數,添加好下代碼

CCEGLView::sharedOpenGLView()->setDesignResolutionSize(1136, 640, kResolutionShowAll);//設定解析度:寬,高,模式

 

4、修改apk應用程式名稱字及表徵圖

修改名字:eclipse項目res->values->strings.xml檔案

<?xml version="1.0" encoding="utf-8"?><resources>    <string name="app_name">小黃人</string></resources>

替換表徵圖:將準備不同大小的icon,替換掉eclipse項目res下drawable-*相應的目錄下png圖片,程式會根據手機的解析度調用相應的icon
 

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.