2015-05-04 92 views
0

我有一个问题,希望能对你有所帮助。我得到一些Cocos2dx源代码,我想在Play商店如何在eclipse中导入cocos2dx项目

我希望有人能告诉我如何添加Cocos2dx基于Eclipse在Windows机器上

,所以我将能够发布这些代码,请您及时发布人能告诉我一步我应该怎么办步骤..

感谢

+0

http://stackoverflow.com/questions/14096191/cant-link-to-cocos2dx-using-eclipse-for-android-on-osx?rq=1 –

+0

爵士的可能的复制,我有这些搜索链接,但没有找到确切的解决方案。请帮助我。 – user2996533

+0

你已经尝试了这些链接,但是你没有告诉我们你已经成功完成了哪些步骤,也没有告诉我们你目前所执行的步骤。换句话说,你真的没有告诉我们任何事情,但你仍然希望我们写出详细的步骤详细指导你做什么。你真的很认真吗?真?我们只是无偿的志愿者回答问题。如果你不愿意为此付出任何努力,我们没有任何理由应该努力回答你的问题。 –

回答

1
Hello friend i am also working on cocos2dx .. and i have done setup correctly and its working for me ... i am going to describe what i have done........it may help for you as well as others 



=============cocos2dx android setup guide===================================== 

- check for these 6 things 
    1-> adt 
    2-> ndk 
    3-> cocos2dx 
    4-> Python 
    5-> cygwin (setup-x86_64) 
    6-> jdk 

// now do all steps one by one 

1-> first create a specific folder where you want to setup android 
2-> copy all these files (which mentioned above) 
3-> extract adt 
4-> extract ndk 
5-> extract cocos2dx 
6-> install python 
7-> install cygwin (to install this you need internet connection ..so follow the steps under -- how to install cygwin) 
8-> setup environment variable for cygwin ----- 
        -to set this open environment variable which you find mycomputer->properties->advance settings->environment variable 
        - now find path variable and add the path of cygwin ex-- mine ic c:/cygwin64/bin 
        - add another variable for ndk NDK_ROOT -> mine is F:\myworkspace\Android\adt-bundle-windows-x86-20130219\android-ndk-r10d 

9 -> check for java (jdk) for eclipse , if not then install java 
10-> set environment variable -> edit path ---add path for java ; C:\Program Files (x86)\Java\jdk1.6.0_20\bin; 
    at start of this path 
11->you have done android setup ; 




how to install cygbin 
============================= 

-> double click on cygbin file->click next->next->next->next->next- 
-> now select mirror any one i choose http://cygbin.mirror.constant.com 
-> click next 
-> now u got select package -> search for the following one by one 
     autoconf, automake, binutils, gcc-core, gcc-g**, gcc4-core, gcc4-g**, gdb, pcre, pcre-devel, gawk, make 


     neccesory packages---> make 

     ->and follow the instructions 


======================================  
    finally ... you have done with setup now open elipse 
    import your project -race track->proj.android 
    import libcocos2dx---> CoCos2Dx\cocos2dx\platform\android\java 

now open cygbin.bat file-> go to you project resourse directory -> run command -- chmod -R 777 * 
    clean your project and run 








============================================================================================================== 
    CREATE NEW PROJECT IN COCOS2DX BY COMMAND PROMPT 
============================================================================================================== 


    1-> open cmd 
    2-> 

    go to path--CoCos2Dx\tools\project-creator (MINE WAS F:\myworkspace\Android\adt-bundle-windows-x86-20130219\CoCos2Dx\tools\project-creator) 
     now typing cd above path then press enter 
     now type f: press enter 
3-> type command create_project.py -project MyGame -package com.sensiblemobiles.mygame -language cpp 
then press enter 

4-> you have done with this. a project is created in cocos2dx/projects folder 
5-> now to add this project in adt follow istruction (HOWW TO ADD COCOS2DX PROJECT IN ADT 






=============================================================================================================== 
         HOW TO ADD COCOS2DX PROJECT IN ADT 
============================================================================================================== 

follow thest steps to import a cocos2dx project for android in adt eclipse 



1-> open eclipse go to file->import->Existing android code into workspace (under android tab) ->click next-> click on Browse 
2-> Go to your project root folder like MyGame->proj.android 
3-> finish , your project will be added into project explorer 


4-> to enable cocos2dx you need to import libcocos2dx follow above instruction same and go to root directory by following below path 

-> CoCos2Dx\cocos2dx\platform\android\java (F:\myworkspace\Android\adt-bundle-windows-x86-20130219\CoCos2Dx\cocos2dx\platform\android\java) 

5-> now add this libcocos2dx in to your project 
    -> right click on your project ->properties->click android tab -> click add button -> select libcocos2dx -> ok -> apply ->ok 

6-> Now to see your classes in this project follow below instruction 

    -> right click on your project -> properties -> explore resourse tab -> linked resourse -> path variables -> Now click on add (a dialog will be Open) 
     - Name : COCOS2DX 
     - Location : enter path of your cocos2dx (mine was F:\myworkspace\Android\adt-bundle-windows-x86-20130219\CoCos2Dx) 
    - click ok -> again OK 

7-> you need some more steps below 

     -> right click on your project -> explore tab C/c++ General -> select Code Analysis -> select Use Project Setting -> now uncheck Syntax and Symantic errors -> apply -> ok 

8-> Add path of cocosdension 

again go to your project -> right click -> explore tab C/c++ General -> Path and Symbol -> selsect Include Tab -> select GNU++ -> click on Add button 
     -> fill dialog box paste path of cocos2dx/cocosdension/include (mine was F:\myworkspace\Android\adt-bundle-windows-x86-20130219\CoCos2Dx\CocosDenshion\include)   
     - press ok -> apply -> ok 

9->Now go to Project Tab of adt -> clean your project 

10-> finally you have done 



============================================================================================================================= 
    NOW MAKE FEW CHANGES TO YOUR ANDROID.MK FILE 
============================================================================================================================= 
EXPLORE YOUR PROJECT -> JNI -> ANDROID.MK 

NOTE : LOCAL_SRC_FILES := hellocpp/main.cpp \ 
        ../../Classes/AppDelegate.cpp \ 
        ../../Classes/HelloWorldScene.cpp 

      BELOW THE ABOVE LINES YOU HAVE TO ADD ALL CPP FILES LIKE ABOVE WITHOUT ANY SPACES 



=============================================================================================================================== 
     ENABLE BOX 2D IF YOU WANT TO USE BOX2D 
=============================================================================================================================== 
FOLLOW ALL THE ABOVE STEPS TO CREATE NEW PROJECT AND IMPORT IT IN ADT ECLIPSE ; 

NOW FOLLOW SOME MORE STEPS TO ENABLE BOX2D; 


1->  right click on your project -> properties -> explore resourse tab -> linked resourse -> path variables -> Now click on add (a dialog will be Open) 
     - Name : Box2D 
     - Location : enter path of your Box2d (mine was F:\myworkspace\Android\adt-bundle-windows-x86-20130219\CoCos2Dx\external\Box2D) 
    - click ok -> again OK 

2-> now include box2d in include 
     again go to your project -> right click -> explore tab C/c++ General -> Path and Symbol -> selsect Include Tab -> select GNU++ -> click on Add button 
     -> fill dialog box paste path of \CoCos2Dx\external\Box2D (mine was F:\myworkspace\Android\adt-bundle-windows-x86-20130219\CoCos2Dx\external\Box2D)  
     - press ok -> apply -> ok 

3->   now add Box2D source 

      again go to your project -> right click -> explore tab C/c++ General -> Path and Symbol -> select Source Location Tab -> select Link Folder -> check the chek box 
     -> paste path of \CoCos2Dx\external\Box2D (mine was F:\myworkspace\Android\adt-bundle-windows-x86-20130219\CoCos2Dx\external\Box2D)  
     - press ok -> apply -> ok 

4-> change in application.mk file 

    EXPLORE YOUR PROJECT -> JNI -> application.mk 
     replace this line ( APP_CPPFLAGS := -frtti -DCC_ENABLE_CHIPMUNK_INTEGRATION=1 -DCOCOS2D_DEBUG=1) 
     to -- APP_CPPFLAGS := -frtti -DCC_ENABLE_CHIPMUNK_INTEGRATION=0 -DCOCOS2D_DEBUG=1 -DCC_ENABLE_BOX2D_INTEGRATION=1 

Note -> this will enable Box2d and disable chipmunk 
    finaly save this file  

5-> change in android.mk file 

    EXPLORE YOUR PROJECT -> JNI -> android.mk 

     after this line (LOCAL_C_INCLUDES := $(LOCAL_PATH)/../../Classes) with "space" 
     add path of box2d like ($(LOCAL_PATH)/../../../../external/Box2D) after the line 

Note -> this will include Box2d 
    finalLy save this file   

6-> ok you have done with box2d . clean your project an enjoy... best of luck 



============================================================================================================================================= 
REMEMBER FEW THINGS 
============================================================================================================================================ 

1-> ADD NEW CLASS IN CLASSES FOLDER 
2-> ADD ALL RESOURCE INTO RESOURSEC FOLDER 
3-> AFTER ADDING NEW RESOURE REFRESH YOUR ANDROID PROJECT THEN RUN (PERMISSION) COMMAND INTO CYGWIN 
     (cygbin.bat file-> go to you project resourse directory -> run command -- chmod -R 777 * ) 
0

尝试以下链接

  1. “如何在Android上运行的CPP-测试”: http://www.cocos2d-x.org/wiki/How_to_run_cpp-tests_on_Android
  2. “唯一齐全的Cocos2D-X教程&指南列表”: The Completest Cocos2d-x Tutorial & Guide List
  3. “的Cocos2D-X教程适用于iOS和Android:入门”: http://www.raywenderlich.com/33750/cocos2d-x-tutorial-for-ios-and-android-getting-started

简单地说,你将有为Android SDK 012

  1. 的Java JDK安装库
  2. 安装库NDK
  3. 提取Cocos2dx对于Cocos2dx 2.2.x,您可以使用Cygwin。对于 cocos2dx 3.x中,你可以使用Python和蚂蚁
  4. 下载并在Eclipse
  5. 提取的Eclipse
  6. 安装Eclipse插件ADT
  7. 导入Android项目
  8. 尝试构建和运行它。

你在哪一步?