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.mzph.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…

初学者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的新用户,则知…

如何在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…

获取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模板: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实现移动端左滑删除效果附源码

左滑删除在移动端是很常见的一种操作,常见于删除购物车中的商品,删除收藏夹中文章等等场景。我们只需要手指按住要删除的对象,然后轻轻向左滑动,便会出现删除按钮,然后点击删除按钮即可删除对象。点击下载源码今天我给…

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,初步测试后对其表现比较满意,具体可看http://forum.xitek.com/thread-1314865-1-1-1.html。7月初到8月中旬我都处于旅行状态中,佳能系统带了三支镜,包括EFS10-18,EFS55-250和EF24IS&…

文件下载至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…

supervisord的安装使用

由于生产环境使用的的tomcat,项目比较重要,所以要做进程守护,本来打算自己写脚本,但是效果不理想,想了下还是用supervisord了 由于很久不用,所以写下来部署步骤 第一:安装,安装的方法…

如何在Windows 10上使用Microsoft Defender扫描文件或文件夹中的恶意软件

On Windows 10, Microsoft Defender (formerly called “Windows Defender”) always scans files before you open them unless you’ve installed a third-party antivirus. You can also perform a quick scan of any file or folder, too. Here’s how. 在Windows 10上&…

html中怎么获取搜索框中的值,百度API 搜索框,获取相应的地点的uid

在百度API的输入框中怎么根据搜索到的地址获取百度的uidbody, html{width: 100%;height: 100%;margin:0;font-family:"微软雅黑";font-size:14px;}#l-map{height:300px;width:100%;}#r-result{width:100%;}关键字输入提示词条请输入:// 百度地图API功能function G(id…

uac2.0驱动_关闭Vista中令人讨厌的HP驱动程序UAC弹出更新检查

uac2.0驱动If you are using Vista and have an HP printer, especially of the All-In-One variety, you’ve probably noticed that once a week or so you get this obnoxious User Account Control popup dialog out of the blue asking for permission to run some Hewlet…

html5结构与表现分离原则,网页简单布局之结构与表现原则分享

一般来说html结构 css表现 javascrip行为,网页布局要考虑到结构,表现,行为分离原则,首先重点放在结构和语义化上面,再考虑CSS,JS等,便于后期维护和分析。结构与表现相关内容简介html结构 css表现…

如何在Firefox 3中重新启用about:config警告消息

If you’ve spent any time tweaking Firefox 3, you’ve probably seen the warning message telling you that you probably shouldn’t be changing any settings. Thankfully you can remove the checkbox and make the message go away… but what if you wanted it back?…

iaas层次化结构--从业务需求到设计需求

转载于:https://www.cnblogs.com/anc-ox/p/10004571.html

清华经管计算机金融专业,非量化背景拿下MIT MFin的清华经管学姐,详解MIT金融项目优劣和职业方向...

学员背景清华大学 经管学院主要获录Offer麻省理工大学金融硕士MIT MFin哥伦比亚大学公共管理硕士Columbia MPA来自清华经管F学姐,以非量化背景成功斩获MIT金融和哥大MPA项目。她与大家分享了MIT金融项目的特色、优劣势、录取信息和未来的职业方向,同时也…

保存页面供以后使用Firefox的阅读列表扩展

I spend an enormous amount of time browsing the web looking for new ideas to write about, so one of the biggest problems for me is tagging articles for more careful reading later. Also, I’m sure any moment I’m going to reach a page that says “You’ve re…