Cocos2d-x 3.x uses the chipmunk physical engine by default. If we want to use the box2d engine, some settings and adjustments are required, and these settings vary with development platforms. Since this book previously introduced the Win32 platform developed based on Microsoft's Visual Studio 2012, This section describes the settings of the box2d development environment under Visual Studio 2012.
These settings and adjustments are as follows:
Add the libbox2d library project to the solution.
Add libbox2d library reference.
Enable the box2d pre-compilation switch.
1. Add the libbox2d Library to the solution
First, open solution, right-click solution hellobox2d, and choose "add"> "existing items" from the context menu ",.
Open the libbox2d PROJECT IN SOLUTION
In the displayed dialog box, select the box2d. vcxproj project file. The specific project path is "<project directory> \ cocos2d \ external \ box2d \ proj. Win32 \ box2d. vcxproj ". After adding, we can see that the libbox2d project is added to the solution ,.
Add a libbox2d Project
2. Add libbox2d Library Reference
Then, in the solution, right-click the project hellobox2d and choose Properties From the shortcut menu. The Project Properties dialog box is displayed, in the Properties dialog box, select "general attributes"> "framework and reference", click "Add new reference" on the right, and select "libbox2d" in the displayed dialog box ", click "OK.
Add libbox2d Library Reference
3. Enable the box2d pre-compilation switch.
Open the Properties dialog box, select "configuration properties"> "C/C ++"> "Preprocessor", and then find cc_enable_chipmunk_integration = 1 in the "Preprocessor" on the right, modify it to cc_enable_box2d_integration = 1. In this way, the physical engine used by the Framework is changed from chipmunk to box2d ,. After modification, click "OK.
Enable box2d pre-Compilation
More content please pay attention to the first domestic Cocos2d-x 3.2 version of the book "Cocos2d-x practice: C ++ volume"
This book discussion site: http://www.cocoagame.net
For more exciting video courses, please follow the Cocos Course: http://v.51work6.com
Welcome to Cocos2d-x Technology Discussion Group: 257760386
Welcome to Zhijie IOS public classroom Platform
Visual Studio 2012 box2d Development Environment Settings