setting up box2d with project-creator script?

Hi, is it possible to use the multiplatform project-creator.py script to include Box2d? I’ve seen this tutorial linked a lot: http://bold-it.com/ios/cocos2d-x-box2d-iosandroid-hybrid-tutorial/ but the create-android-project script it uses is deprecated/gone right?

If I have to add Box2d it manually, can someone go through each step please? Maybe cocosdenshion as well if its similar process? It took me a week to setup cocos2d properly the first time and adding libraries and stuff gets really confusing for me :frowning:

i have done this manually - you need to

  1. search for CC_ENABLE_CHIPMUNK_INTEGRATION=1 and change to CC_ENABLE_BOX2D_INTEGRATION=1 in the preprocessor definitions
  2. set $(COCOS_ROOT)/external/Box2D/ in the header search path. for your app.

thanks, but which files are these changes in? And i don’t have to copy any folders over or set up libraries through Eclipse at all?

in application folder proj.android/jni/Android.mk, cocos/2d/Android.mk and extensions/Android.mk

I think you should set the include path to $(COCOS_ROOT)/external/ as the Box2d includes are of the form #include “Box2D/Box2D.h”
Hope this helps…

PRakash Ramachandran wrote:

i have done this manually - you need to

  1. search for CC_ENABLE_CHIPMUNK_INTEGRATION=1 and change to CC_ENABLE_BOX2D_INTEGRATION=1 in the preprocessor definitions
  2. set $(COCOS_ROOT)/external/Box2D/ in the header search path. for your app.

hi are you guys using 2.2? I am having trouble box2d to compile … I have made changes to android.mk file and still it doesnt work…

I made a mistake in my comment earlier… set an entry in your include path to $(COCOS2DX_ROOT)/external
I am using 2.2.1

oh ok. do I have to make changes to all the .mk files or just the one in the jni folder?

What compile errors do you get? There could be many reasons for your problems…

The game was building fine before I included box2d

basically anything that involved box2d it says it cant resolve desnsity, friciton, shape, createfixture.

also

make: *** [obj/local/armeabi/libcocos2dcpp.so] Error 1 CrazyFruties C/C++ Problem

and

undefined reference to ‘GLESDebugDraw::GLESDebugDraw(float)’ CrazyFruties line 66, external location: /Users/siddharthshekar/Androidkit/ndk-r8c/toolchains/arm-linux-androideabi-4.6/prebuilt/darwin-x86/arm-linux-androideabi/bin/ld: ./obj/local/armeabi/objs/cocos2dcpp_shared///Classes/HelloWorldScene.cpp C/C++ Problem

and this is my .mk file

LOCAL_PATH := $(call my-dir)

include $(CLEAR_VARS)

LOCAL_MODULE := cocos2dcpp_shared

LOCAL_MODULE_FILENAME := libcocos2dcpp

LOCAL_SRC_FILES := hellocpp/main.cpp …/…/Classes/AppDelegate.cpp …/…/Classes/HelloWorldScene.cpp …/…/Classes/B2DebugDrawLayer.cpp …/…/Classes/ContactListener.cpp …/…/Classes/GB2SHapeCache-x.cpp …/…/Classes/GLES-Render.cpp

LOCAL_C_INCLUDES := $(LOCAL_PATH)/…/…/Classes /home/user/siddharthshekar/Documents/_Projects/cocos2d-x-2.2_master/external /home/user/siddharthshekar/Documents/_Projects/cocos2d-x-2.2_master/external/Box2D

LOCAL_WHOLE_STATIC_LIBRARIES = cocos2dx_static
LOCAL_WHOLE_STATIC_LIBRARIES
= cocosdenshion_static
LOCAL_WHOLE_STATIC_LIBRARIES = box2d_static
LOCAL_WHOLE_STATIC_LIBRARIES
= chipmunk_static
LOCAL_WHOLE_STATIC_LIBRARIES += cocos_extension_static

include $(BUILD_SHARED_LIBRARY)

$(call import-module,cocos2dx)
$(call import-module,cocos2dx/platform/third_party/android/prebuilt/libcurl)
$(call import-module,CocosDenshion/android)
$(call import-module,extensions)
$(call import-module,external/Box2D)
$(call import-module,external/chipmunk)

it works with the mk file above aI just had to close and restart eclipse … lame…. :slight_smile: but thanks for the help