cocos android-1,cocos2dx在windows下開發,編譯到android上(1)

轉自:http://www.2cto.com/kf/201205/130697.html

下面我給大家介紹下,用vs2010開發cocos2dx,然后如何使其編譯到android上。步驟如下:

1、必要條件,你的eclipse能把代碼編譯到安卓手機或虛擬機上,如果這一步還沒做好,先用谷歌百度查查看,然后把環境配置好。【我sdk的目錄是:E:\android\android-sdk-windows】

2、下載cygwin并安裝。這個也請到網上看看教程,轉好的cygwin一定要保證能用gcc、g++,make,vi等命令。我安裝的目錄是:E:\android\cygwin

3、下載ndk。如果ndk還不知道什么意思的話,也請先一步谷歌百度。ndk你下載解壓放在一個地方就好了。我解壓后的目錄是:E:\android\android-ndk-r7

4、下載最新版的cocos2dx。我將cocos2dx解壓在E:\android\cocos2d-1.0.1-x-0.13.0-beta。在這個目錄下找到:create-android-project.bat然后用cygwin進行編輯,我create-android-project.bat修改后的效果如下:

[plain]

@echo off

:: This script is used to create an android project.

:: You should modify _ANDROIDTOOLS _CYGBIN _NDKROOT to work under your environment.

:: Don't change it until you know what you do.

setlocal

:: Check if it was run under cocos2d-x root

if not exist "%cd%\create-android-project.bat" echo Error!!! You should run it under cocos2dx root & pause & exit 2

if not exist "%~dpn0.sh" echo Script "%~dpn0.sh" not found & pause & exit 3

:: modify it to work under your environment

set _CYGBIN=E:\android\cygwin\bin

if not exist "%_CYGBIN%" echo Couldn't find Cygwin at "%_CYGBIN%" & pause & exit 4

:: modify it to work under your environment

set _ANDROIDTOOLS=E:\android\android-sdk-windows\tools

if not exist "%_ANDROIDTOOLS%" echo Couldn't find android sdk tools at "%_ANDROIDTOOLS%" & pause & exit 5

:: modify it to work under your environment

set _NDKROOT=E:\android\android-ndk-r7

if not exist "%_NDKROOT%" echo Couldn't find ndk at "%_NDKROOT%" & pause & exit 6

:: create android project

set /P _PACKAGEPATH=Please enter your package path. For example: org.cocos2dx.example:

set /P _PROJECTNAME=Please enter your project name:

if exist "%CD%\%_PROJECTNAME%" echo "%_PROJECTNAME%" exists, please use another name & pause & exit 7

echo "Now cocos2d-x suppurts?Android?2.1-update1, 2.2, 2.3 & 3.0"

echo "Other versions have not tested."

call "%_ANDROIDTOOLS%\android.bat" list targets

set /P _TARGETID=Please input target id:

set _PROJECTDIR=%CD%\%_PROJECTNAME%

echo Create android project

call "%_ANDROIDTOOLS%\android.bat" create project -n %_PROJECTNAME% -t %_TARGETID% -k %_PACKAGEPATH% -a %_PROJECTNAME% -p %_PROJECTDIR%

:: Resolve ___.sh to /cygdrive based *nix path and store in %_CYGSCRIPT%

for /f "delims=" %%A in ('%_CYGBIN%\cygpath.exe "%~dpn0.sh"') do set _CYGSCRIPT=%%A

:: Resolve current dir to cygwin path

for /f "delims=" %%A in ('%_CYGBIN%\cygpath.exe "%cd%"') do set _CURRENTDIR=%%A

:: Resolve ndk dir to cygwin path

for /f "delims=" %%A in ('%_CYGBIN%\cygpath.exe "%_NDKROOT%"') do set _NDKROOT=%%A

:: Throw away temporary env vars and invoke script, passing any args that were passed to us

endlocal & %_CYGBIN%\bash --login "%_CYGSCRIPT%" %_CURRENTDIR% %_PROJECTNAME% %_NDKROOT% %_PACKAGEPATH% "windows" -l -b

pause

修改的地方有三個:A: set _ANDROIDTOOLS=E:\android\android-sdk-windows\tools

B: set _NDKROOT=E:\android\android-ndk-r7

C:set _CYGBIN=E:\android\cygwin\bin

這三個地方修改成你自己安裝的目錄就好了。

5、以上幾步是確保你eclipse環境配置完成,下面進入正題。你先把你的cocos2dx項目在vs2010上運行。

6、在cygwin上,進入cocos2dx,輸入以下命令:

55702632f5d790b1105c4c42f3e412b7.png

接著,回車,你將看到下面的信息,并輸入:

124ea254589a46828d3213119d35ae41.png

回車,顯示下面信息,并請輸入:

fe9e909b15a9d25bfc55504ee908f7b9.png

回車,請稍等,你將看到下面的信息:

ed8b05145b4294cadce08d958f395a09.png

接著輸入你想要創建android的版本,加入你想創建Android2.3.3,那么輸入15,如下圖:

ad25b7048c5becfc44089a59c74cec5b.png

回車,cygwin會進行一些處理,然后cocos2dx項目創建完畢。

打開cocos2dx文件夾,你將看到你剛創建的文件夾,文件夾里有以下文件夾:

7、這一步,請將你用vs2010編譯的項目中的Classes下的文件拷貝到Classes,同理,vs2010下的Resource里的文件拷貝到Resource下

8、打開我們剛才生產的teachYou,修改\android\jni下的Android.mk文件。只把你的.cpp文件加進去就行了。

9、打開cygwin,把\android下的build_native.sh拖到cywin回車,編譯就行了。

10、然后用eclipse將文件夾android? import進去就可以了

本文來自互聯網用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務,不擁有所有權,不承擔相關法律責任。
如若轉載,請注明出處:http://www.pswp.cn/news/278881.shtml
繁體地址,請注明出處:http://hk.pswp.cn/news/278881.shtml
英文地址,請注明出處:http://en.pswp.cn/news/278881.shtml

如若內容造成侵權/違法違規/事實不符,請聯系多彩編程網進行投訴反饋email:809451989@qq.com,一經查實,立即刪除!

相關文章

中藥ppi網絡圖太雜亂_太雜亂了嗎? 這是您的iPhone,iPad,Android或臺式機的15張簡約壁紙...

中藥ppi網絡圖太雜亂Busy wallpaper images don’t work very well on your iPhone, iPad, or any device where you need to have lots of icons on the screen. Here’s a set of minimalistic wallpaper images that won’t clutter up your desktop. 繁忙的墻紙圖像在iPhon…

算法61---兩個字符串的最小ASCII刪除和【動態規劃】

一、題目: 給定兩個字符串s1, s2,找到使兩個字符串相等所需刪除字符的ASCII值的最小和。 示例 1: 輸入: s1 "sea", s2 "eat" 輸出: 231 解釋: 在 "sea" 中刪除 "s" 并將 "s" 的值(115)加入總和。 在…

android設置時間widget,【Android】時間與日期Widget(DatePicker 與 TimePicker)

public class Activity01 extends Activity{TextViewm_TextView;//聲明dataPickerDatePickerm_DatePicker;//聲明TimePickerTimePickerm_TimePicker;Button m_dpButton;Button m_tpButton;//java中的Calendar類Calendar c;/** Called when the activity is first created. */Ov…

初學者java學習計劃_初學者:計劃在Windows 7 Media Center中錄制直播電視的時間

初學者java學習計劃If you’re a new user to Windows 7 Media Center you know it can act as a DVR and pause or record Live TV. You can set up a schedule for it to record your favorite TV programs as well. 如果您是Windows 7 Media Center的新用戶,則知…

雙數據源配置

從此抄錄&#xff1a;https://blog.csdn.net/ll535299/article/details/78203634 1、先配置兩個數據源&#xff0c;附上主要代碼&#xff0c;給自己回憶&#xff0c;詳解見開頭鏈接 <!-- 配置數據源 --> <bean id"szDS" class"com.alibaba.druid.pool.…

如何在Office 2007中查看關于對話框和版本信息

One of our favorite readers wrote in today asking how to tell if his Word 2007 installation was running Service Pack 1, since he couldn’t find the About dialog, which got me thinking… I bet most people don’t know where it is! 我們最喜歡的一位讀者今天寫信…

windows全局熱鍵_在Windows中創建快捷方式或熱鍵以清除剪貼板

windows全局熱鍵Have you ever copied something to the clipboard that you don’t want to leave there in case somebody else is going to use your computer? Sure, you can copy something else to the clipboard real quick, but can’t you just make a shortcut or h…

android+notepad教程,Android Sample學習——NotePad

android.view.Menu專場Interface for managing the items in a menu.By default, every Activity supports an options menu of actions or options. You can add items to this menu and handle clicks on your additions. The easiest way of adding menu items is inflating…

Windows應用程序開發

Windows窗體應用程序開發&#xff1a;WinForm、桌面應用程序&#xff0c;有可執行文件(.exe)即安裝包。是一種C/S&#xff08;客戶機/服務器&#xff09;架構應用程序 1.Windows窗體應用程序&#xff0c;用可視化的窗體和控件生成豐富界面的&#xff0c;可交互操作的應用程序。…

獲取outlook 會議_如何僅在Microsoft Outlook中僅獲取您關注的電子郵件的通知

獲取outlook 會議Some emails are more important than others. Rather than getting alerts every time an email arrives, configure Microsoft Outlook to only alert you when the important stuff hits your inbox, rather than any old email that can wait until you ch…

jq html 多一個引號,為什么jQuery模板會為某些字符串添加雙引號

背景我正在使用jQuery模板,ASP.Net MVC Razor視圖和Twitter.問題使用帶有一些字符串的jQuery模板會自動導致這些字符串被包含在“細節我創建了一個如下所示的jQuery模板&#xff1a;before ${text.parseUserName().parseHashTag()} after${created_at}${prettyDate(created_at)…

從Windows計算機上完全刪除iTunes和其他Apple軟件

If you are giving up on iTunes for another music player, uninstalling it completely can be a hassle. Here we show you how to completely remove all traces of it including QuickTime, iTunes Helper, Bonjour…all of it. 如果您在iTunes上放棄了其他音樂播放器&…

html仿微信滑動刪除,使用Vue實現移動端左滑刪除效果附源碼

左滑刪除在移動端是很常見的一種操作&#xff0c;常見于刪除購物車中的商品&#xff0c;刪除收藏夾中文章等等場景。我們只需要手指按住要刪除的對象&#xff0c;然后輕輕向左滑動&#xff0c;便會出現刪除按鈕&#xff0c;然后點擊刪除按鈕即可刪除對象。點擊下載源碼今天我給…

推薦書本_

1. c#_設計模式 《設計模式&#xff1a;可復用面向對象軟件的基礎》GoF 《面向對象分析與設計》Grady Booch 《敏捷軟件開發&#xff1a;原則、模式與實踐》 Robert C.Martin 《重構&#xff1a;改善既有代碼的設計》 Martin Fowler 《Refactoring to Patterns》Jshua Kerievsk…

h5 領取優惠券 下載_下載7天免費試用版或購買VideoProc,可享受60%優惠券[贊助的帖子]...

h5 領取優惠券 下載You may have seen piles of video editing tools, but here we’ll show you a different one – VideoProc, developed by Digiarty Software, Inc. It is not a “standard” video editing program. Some consider VideoProc a complete toolbox also fo…

html走馬觀花效果,走馬觀花臺灣行 用EF-S 10-18來記錄風景

我在6月初入手無忌第一支10-18&#xff0c;初步測試后對其表現比較滿意&#xff0c;具體可看http://forum.xitek.com/thread-1314865-1-1-1.html。7月初到8月中旬我都處于旅行狀態中&#xff0c;佳能系統帶了三支鏡&#xff0c;包括EFS10-18&#xff0c;EFS55-250和EF24IS&…

一大波學習內容!

Dubbo-大波-服務化框架 dubbo_百度搜索Dubbo與Zookeeper、SpringMVC整合和使用&#xff08;負載均衡、容錯&#xff09; - 好庫文摘User Guide-zh - Dubbo - Alibaba Open SesameUser Guide-zh - Dubbo - Alibaba Open Sesame簡單之美 | Dubbo架構設計詳解DUBBOHprose RPC框架 …

文件下載至storage_如何防止Storage Sense在Windows 10上刪除下載的文件

文件下載至storageStorage Sense is the Disk Cleanup replacement for the modern world. It frees up space on your computer by deleting things like recycle bin contents, temporary internet files, and app temporary files. This also includes the Downloads folder…

html標簽屬性和標簽事件,HTML參考手冊( 標簽、屬性和事件)

HTML標簽標簽 描述 DTD定義注釋。 STF定義文檔類型。 STF定義錨。 STF定義縮寫。 STF定義只取首字母的縮寫。 STF定義文檔作者或擁有者的聯系信息。 STF 不贊成使用。定義嵌入的 applet。 TF 定義圖像映射內部的區域。 STF 定義粗體字。 STF 定義頁面中所有鏈接的默認地址或默認…

Feign從配置文件中讀取url

Feign的url和name都是可配置的&#xff0c;就是從配置文件中讀取的屬性值&#xff0c;然后用占位符引用就可以了&#xff1a; ${rpc.url} FeignClient(name "me",url "${rpc.url}", // 這里是可以配置的, 就不用再硬編碼了fallbackFactory MyHystrixFa…