I ported cocos2d-x( or cocos2dx? that is one of the famous game libraries)'s "chipmunk" & "BOX2D"
to the Android Apps(applications) as to work. ( Movie → ) http://youtu.be/fEVbocT8BtE
NOTE : HWc&h = HelloWorldScene.cpp and HelloWorldScene.h ( are "C++(cpp & h) files". ) , Ap = Application.mk , A = Android.mk ( are "mk files". ) Dir(fld) = Directory(or Folder) , j = jni(Dir) , h = helloworld(Dir) , C = Classes(Dir) , H = HelloWorld(Dir(fld). TopDir of this changing&creating , not "helloworld(Dir)" above. ) , a_in_t = android(Dir(fld)_in_template(Dir(fld) other than(outside) HelloWorld Dir(fld). ) / B2D = Box2D(Dirs or files)
version→ | 11 | 12 | 13beta |
intoH Dir | "HWc&h" inC(in H)Dir(=2) | "HWc&h" inC(in H)Dir(=2) | "HWc&h" inC(in H)Dir(=2) ,←All are the same |
"A" inC /Ap&A in j / A in h(inj) | "A" inC /Ap&A in j / A in h(inj) =6 | "A" inj(Ap no changed/No Ain h(inj)&in C) =3 | |
( & "Only 11(except 12or13b)Box2D's Box2D" Dir(on the outside of HDir)ectry are copied into C(in H)Directry. ) | |||
into t Dir | "Ap" in t =7(&1 Dir(v11 B2D)) |
(A(=1. & continuation of 1. )) After "1."as above (i.e. after creating xCode's files of versions and types that you want to create), please also create android's cocos2d-x files of versions and types that you want to create by create-android-project.sh. Incidentally, I think no need particularly for descriptions about modifing "NDK_ROOT_LOCAL" and "ANDROID_SDK_ROOT_LOCAL" at the beginning of this "create-android-project.sh" because many descriptions already exist in various other places. Such as NDK_ROOT_LOCAL="/home/laschweinski/android/android-ndk-r5"( → "/xxx/android-ndk-r(6,7etc)") ANDROID_SDK_ROOT_LOCAL="/home/xxxxx/android/android-sdk-linux_86"( → "/Applications/android-sdk") and "the created files of the name that you want to create are used (C) below. And then, If you will create App of the later than varsion 11(equal 12,13beta...,in all types(B2D&chipmunk)) Please Change at the beginning of "create-android-project.sh" as "NEED_BOX2D=true or NEED_CHIPMUNK=true". (Be careful if it does not, you can't create App of the later than varsion 11 in all types at all.)
(B(=2.)) Please copy the files that are on the "chg© list" as of the list. By the way, In All versions(as 11,12,and 13beta) which are created by "create-android.sh", 11 includes a "Resourace" directory but it's "(ending in s and) Resources" in 12 and 13b. (As a result, "A in C"( = Android.mk in C((lasses in H(lloWorld))Dir(ectry)) ) of 11 are only differd , among the "mk.files". ) However, the contents in each Directories(Not only for all versions(11-13b),all types(B2D&chipmunk), too.) are almost the same except that " 12 and 13 don't exist the icon.png but exist the font Dir, on the contrary, only 11 don't exists the font Dir but exist icon.png ". That's why all you need to do is copy the contents in the "Resource(s)" Dir(ectry) to the "Resource(s)" Dir(ectry) in C((lasses in H(lloWorld))Dir(ectry)) that you want create. ( As an aside, Not only the files described in the above list, you can be downloaded "several types of image files (for B2D)" in this page. These can be chenged as you modify HelloWorldScene.h(of HWc&h files) any time quickly & freely. ) And only if you want to use B2D, each person please save xCode's files of 1. above and copy into position such as sorry in repeating. ( Besides, also as an aside, HelloWorldScene.cpp( among the HWc&h( = HelloWorldScene.cpp and HelloWorldScene.h) ) are used in each cocos2d-x files of versions and types( = chipmunk & B2D and android & xCode ). All of them already have been fixed for all type and version. but HelloWorldScene.cpp for each types( = chipmunk or B2D ) are not changed at all and used in exactly the same content except that 11 and 12 are "CCPoint point = touch->locationInView(touch->view());" but only newest 13beta is without "touch->view()" as "CCPoint point = touch->locationInView();". http://omaena.com/diff_cocos2dxVer11-13b.txt )
(C) After(A)and(B), prease move to the inside of "android Dir" in "a Dir of the name that you want to create" in "android's cocos2d-x Dir( that you want to create)" and compile using "./build_native.sh". I think you create the completed App as above.
(C'(C2) = a supplementary explanation. as not same as " the way of these porting are bold. / description of difference aren't not bold. " above. )
If your created App remains named "Hello World", You need to move to the inside of "android Dir" in "H(HelloWorld)Dir" such as (C) above and modify "NDK_ROOT_LOCAL" and "COCOS2DX_ROOT_LOCAL" at the beginning of "build_native.sh" in this "android Dir". such as NDK_ROOT_LOCAL=/cygdrive/d/programe/android/ndk/android-ndk-r6b(→/xxx/android-ndk-r(6,7etc)) COCOS2DX_ROOT_LOCAL="/home/xxxxx/android/android-sdk-linux_86"(→(the pass of android's cocos2d-x) ) and compile using this build_native.sh as "./build_native.sh"(such as (C) above). or ( Although I am sorry a little that I don't check and try still firmly in fact, ) Using "perl -i -p -e 's/HelloWorld/the_name_that_you_want_to_create/g' `find . -type f`" in H(HelloWorld)Dir and renaming "HelloWorld" to the name that you want to create and compiling with using this build_native.sh as "./build_native.sh"(such as (C) above) is also may be possible. Maybe You're easier the way as above, but the way isn't create e.g."proguard.cfg"(as perhaps preventing to recompile the "apk" file). ( If you only changed the name of App that you want to create, The easiest and most effortless way, might be "only the modifying of string.xml ". )
The app of 13 beta version might be that "display isn't made some changes at the time of the screen changes". All of the version 13 beta sample ( e.g. "HellowWorld" and not only "HelloWorld"("HelloLua" and "test", and others) ) that contains from the present, it may be so. " Please refer to this video. →" http://www.youtube.com/watch?v=EVKQXgVx4jg