zoukankan      html  css  js  c++  java
  • 【转】cocos2dx 详细配置!(一款C++编写的多平台2D游戏开源框架)

    原文地址:http://me.cookfl.com/?p=280

    看了cocos2d-x上的英文教程,配置起来还是很吃力,由于有很多配置需要配,而且文件夹移动也会导致配置失效,经过多次尝试,总结出了这个文章,希望能帮助还在迷惑的童鞋们…有什么疑问可以发邮件给我!i@cookfl.com 一起努力啦!

    Cocos2d-x Android配置详细教程:

    1. cygwin 安装方式网上很多,这里不再赘述。
    2. 下载最新的cocos2d-x :http://www.cocos2d-x.org/projects/cocos2d-x/wiki/Download
    3. 修改解压后cocos2dx文件夹下的Android.mk

    将如下字段修改:

    #it is used for ndk-r4

    #LOCAL_LDLIBS := -L$(LOCAL_PATH)/platform/third_party/android/libraries \

    #                -lGLESv1_CM -llog -lz \

    #                -lpng \

    #                -lxml2 \

    #                -ljpeg \

    #                -lskia

    # it is used for ndk-r5

    # because the new Windows toolchain doesn’t support Cygwin’s drive

    # mapping (i.e /cygdrive/c/ instead of C:/)

    #LOCAL_LDLIBS := -L$(call host-path, $(LOCAL_PATH)/platform/third_party/android/libraries) \

    #                 -lGLESv1_CM -llog -lz \

    #                 -lpng \

    #                 -lxml2 \

    #                 -ljpeg \

    #                 -lskia

    R4版本修改为

    #it is used for ndk-r4

    #LOCAL_LDLIBS := -L$(LOCAL_PATH)/platform/third_party/android/libraries \

    -lGLESv1_CM -llog -lz \

    -lpng \

    -lxml2 \

    -ljpeg \

    -lskia

    # it is used for ndk-r5

    # because the new Windows toolchain doesn’t support Cygwin’s drive

    # mapping (i.e /cygdrive/c/ instead of C:/)

    #LOCAL_LDLIBS := -L$(call host-path, $(LOCAL_PATH)/platform/third_party/android/libraries) \

    #                 -lGLESv1_CM -llog -lz \

    #                 -lpng \

    #                 -lxml2 \

    #                 -ljpeg \

    同理R5版本修改为

    #it is used for ndk-r4

    #LOCAL_LDLIBS := -L$(LOCAL_PATH)/platform/third_party/android/libraries \

    #                -lGLESv1_CM -llog -lz \

    #                -lpng \

    #                -lxml2 \

    #                -ljpeg \

    #                -lskia

    # it is used for ndk-r5

    # because the new Windows toolchain doesn’t support Cygwin’s drive

    # mapping (i.e /cygdrive/c/ instead of C:/)

    LOCAL_LDLIBS := -L$(call host-path, $(LOCAL_PATH)/platform/third_party/android/libraries) \

    -lGLESv1_CM -llog -lz \

    -lpng \

    -lxml2 \

    -ljpeg \

    -lskia

    4. 然后找到HelloWorld/android下的build_native.sh 修改

    # set params

    ANDROID_NDK_ROOT=/cygdrive/f/andoridSpace/android-ndk-r5b /*当前机器NDK环境位置*/

    COCOS2DX_ROOT=/cygdrive/d/cocos2d-0.99.5-x-0.8.2 /*当前机器cocos2d-x环境位置*/

    5. 然后修改HelloWorld/android/jni/helloworld下的Android.mk文件

    修改前:

    # it is used for ndk-r5

    # because the new Windows toolchain doesn’t support Cygwin’s drive

    # mapping (i.e /cygdrive/c/ instead of C:/)

    # LOCAL_LDLIBS := -L$(call host-path, $(LOCAL_PATH)/http://www.cnblogs.com/libs/armeabi) \

    #               -lcocos2d -llog -lcocosdenshion

    修改后:

    # it is used for ndk-r5

    # because the new Windows toolchain doesn’t support Cygwin’s drive

    # mapping (i.e /cygdrive/c/ instead of C:/)

    LOCAL_LDLIBS := -L$(call host-path, $(LOCAL_PATH)/http://www.cnblogs.com/libs/armeabi) \

    -lcocos2d -llog –lcocosdenshion

    6. 然后便可以使用cygwin 找到build_native.sh目录下,执行./build_native.sh,等待完成后便可使用Eclipse导入。

    以上为使用Cocos2d-x自带示例项目,如若新建一个项目:首先修改create-android-project.bat(此文件在cocos2dX的根目录下)—-<

    :: modify it to work under your environment

    set _CYGBIN=c:\cygwin\bin /*这里是当前机器cygwin的安装文件夹,里面有bash.exe*/

    if not exist “%_CYGBIN%” echo Couldn’t find Cygwin at “%_CYGBIN%” & pause & exit 4

    :: modify it to work under your environment

    set _ANDROIDTOOLS=F:\andoridSpace\android-sdk-windows\tools /*这里是当前机器androidSDK的文件夹,指向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=F:\andoridSpace\android-ndk-r5b /*这里是当前机器NDK的安装文件夹,里面有ndk_build */

    if not exist “%_NDKROOT%” echo Couldn’t find ndk at “%_NDKROOT%” & pause & exit 6

    >—-

    其他方法与自带示例方式相同不再赘述。

    注意:所有文件使用UltraEdit修改,以免发生保存乱码。

  • 相关阅读:
    康拓展开和康拓逆展开
    快速乘法(基于快速幂)
    扩展欧几里德 POJ 1061
    九度OJ 1552座位问题(dp)
    UVA-10462.Is There A Second Way Left(Kruskal+次小生成树)
    POJ-1679.The Unique MST.(Prim求次小生成树)
    次小生成树(Prim + Kruaskal)
    POJ-1287.Network(Kruskal + Prim + Prim堆优化)
    最小生成树基础算法(Prim + Krustal)
    POJ-2492.A Bug's Life(带权并查集)
  • 原文地址:https://www.cnblogs.com/cappuccino/p/2100766.html
Copyright © 2011-2022 走看看