Thursday, October 15, 2015

How to compile Cocos2d-x with Box2d support Instead of default Chipmunk

Cocos2d-x engine in some stage i think somewhere in version 2 + Changed its default physique engine from Box2d to Chipmunk .
As new developer that just checking this game engine you might think that Cocos2d-x doesn't support Box2d.
Well it does but the configuration is buried deep in the compiler configuration . why .. i have no idea.
But once you understand where to change you will have the support to Box2d right away .
AFTER compiling the project again .

  1. The example will be with Visual Studio 2013 , but its the same in Xcode And Eclipse
    That is in the Preprocessor Definitions .
  2. Once you load your new project in Visual Studio right click on you project name
    then properties.
  3. In the Popup window you see that is opened go to :
    On the left :
    Configuration Properties -> C/C++ -> Preprocessor  (A)
    Then on the right :
    Preprocessor Definition -> click on the small arrow in the drop list and select "<Edit..>" (B)
  4. Once you click on "<Edit..>"  small popup window will be open and called:
     "Preprocessor Definition"
    On the upper Multiline Edit box
    You need to set :
    CC_ENABLE_CHIPMUNK_INTEGRATION=0
    and now you need to add new Preprocessor Definition:
    CC_ENABLE_BOX2D_INTEGRATION=1
    it needs to be like in this image :

  5. Now yo must compile the project again , so the new definition you just set will take effect.




No comments:

Post a Comment