Hello From India !!

Hello From India !!
0.0 0


hello all from India

i am a beginner in cocos2dx and good at libgdx.But libgdx is too detail oreinted and after watching the source code of cocos2dx game its coming naturally to me.
I want to learn the Box2d implementation in cocos2dx using eclipse on windows.Because i found the same thing(box2d) in libgdx very flexible and it gives life to your game.

I have downloaded the cocos2dx 2.0.1 version and want to know how to use box2d in my game.

I have downloaded cygwin.Made my first HelloWorld game and i am already in love with cocos.
Hope someone will help me in using Box2d with eclipse on windows for my cocos game.


Install Ubuntu.


May i know why i need to install Ubuntu if i already have Cocos2dx setuped on my windows machine(using eclipse) running successfully HelloWorld Project ?


Hi Ram,

To use box2d, you need to create the “virtual” box2d world that represents a scaled down version of your real world. You could use a scale of 1:1 too if you like.

The box2d world consists of polygons, circles, rectangles, etc. These are then used to test intersection and perform physics solutions.

If C++ and Windows is the way you are familiar with coding, then you are good to go. You should be able to build the Windows8 project on your box, if it is Windows 8 of course.

If you were a .NET developer then you could also use the cocos2d-xna variant of the library which also has a direct port of box2d in it.


So its a budding community …thanks for the responses first…

@Jacob : thanks for summerising those facts about box2d…but how to use it in the HelloWorld Project (eclispe) ?


Hi Ram, I am not familiar with the hello world project. Chances are you need to use a physics sprite that knows how to interpret itself in the box2d world, so you can transform it according to the box2d solvers.

For instance, you know that you can put a sprite on the screen and make it rotate and translate on the screen. Now you create the box2d world, create a rectangle for your sprite, give it physical properties (the rectangle), and make it do something in box2d by assigning a force to it. Nothing happens. Boo.

So then you setup the box2d query callbacks so you are told when things move. Then you use those callbacks to adjust the properties of your sprite that is assigned to the rectangle (b2Body). The smarter way is to assign the b2Body to your sprite (a physics sprite now), and let the sprite intercept callbacks from box2d so that it manages itself. viola! now your sprite moves with the rectangle in box2d.

Put another sprite in there with an opposite force applied, and watch them collide!


okay so its almost same like there in libgdx…

but there(in libgdx) we need to import the Box2d-imports(box2d required files) via ctrl+shift+o in eclipse manages imports for the java project, to make box2d work…

Do we need some thing similar here too(like the imports) ?

Also HelloWorld is the filename(of C++ source and header files)of the files in the project created (using create-android-project.bat file) using cocos2dx in eclipse for windows


So your question is more of “how to include the box2d libraries in Eclipse” which I do not know. We use Visual Studio and Xamarin Studio here. There is probably some library reference node in the project explorer that would allow you to include the box2d libraries. Maybe when you figure this out, you can add a “create-android-box2d-project.bat” file and push that to the github. :slight_smile:

Sorry that I can’t be of more help with Eclipse.


okay thanks for all the help you have done…

also can you suggest any free tool like eclipse to create cocos2dx game,which will make my work easy like its in visual studio for you ?


Visual Studio Express
Xamarin Studio Community Edition

all free

MonoGame (.NET/XNA)


cocos2d-xna (.NET/XNA)


The easiest way to make a cocos2d game is to use cocos2d builder, but that’s not free. Someone needs to make some money somewhere to keep the project alive, right?


well i think Xamarin Studio Community Edition is not available for free…



Starter edition is free, but you are limited in the size of the project you can build.



Well it will be great if you show me a starter guide for visual studio express editions(as they are free and i am downloading one right away)


ALSO if you have some contacts with the developers/(any one who uses eclipse) they might help me out in importing procedure of box2d using eclipse


Setting cocos2d-x with visual studio express is quite easy and there are tutorials available http://lmgtfy.com/?q=setting+cocos2d-x+visual+studio+express


okay so there were build errors …its like a spiral-loop and i am going in it with every new thing i am facing for cocos2dx…

Developers please help me out i am on this for the last 3 hrs …still no answers/results on how to use box2d with eclipse on windows


@Sergey Shambir : okay i have installed mint …what next i need to do for box2d ?

[i have setup-ed cocos2dx on eclipse normally .Ran the HelloWorld deafult game with no problem.What next for box2d ? ]


There are test project distributed with cocos sources, in directory samples/Cpp/TestCpp. Just build&run this app and find Box2D in examples list. Than look how it implemented in sources.


Are they not available for windows ? ( since its a cross platform )


They are available, of course.


its off-point but why have you suggested to install linux to me ??

Next i am using cocos2dx 2.0.1…
in this we have a folder called ‘test’…inside it there are various topics in which one is ‘Box2dTest’…
when i go into this folder it only includes ‘Box2dTest.cpp’ and ‘Box2dTest.h’ files nothing else

when i see in ‘test’ folder there is test.h and test.cpp but no android.mk or application.mk files present.

Also while searching this forum and on google i found out that this is a big issue from the very beginning and no one has yet solved it (not even developers i think otherwise they would have posted on those various queries about it on this forum)…

Cocos2dx with Box2d using eclipse still a dream incomplete