`

Visual Studio 2012下Box2D开发环境设置

 
阅读更多

Cocos2d-x 3.x默认情况下采用的物理引擎是Chipmunk,如果我们要使用Box2D引擎,需要进行一些设置和调整,而且不同的开发平台下这些设置也有所不同。由于本书在此之前介绍的都是基于微软的Visual Studio 2012下开发的Win32平台,所以这一节我们介绍Visual Studio 2012下Box2D开发环境设置。
这些需要设置和调整的方面包括如下:
在解决方案中添加libBox2D库工程。
添加libBox2D库引用。
开启Box2D预编译开关。

1、在解决方案中添加libBox2D库
首先,打开解决方案,右键点击解决方案HelloBox2D,在右键菜单中选择,“添加”→ “现有项”,如图所示。


在解决方案中打开libBox2D工程

在弹出对话框中选择Box2D.vcxproj工程文件,具体的工程路径是“<工程目录>\cocos2d\external\Box2D\proj.win32\Box2D.vcxproj”。添加完成后,我们会看到解决方案中添加了libBox2D工程,如图所示。

添加libBox2D工程



2、添加libBox2D库引用
然后,我们在解决方案中右键点击工程HelloBox2D,在右键菜单中选择“属性”,弹出如图所示工程属性对话框,在属性对话框中选择“通用属性”→“框架和引用”,接着点击右边“添加新引用”按钮,在弹出对话框中选中“libBox2D”,最后点击“确定”按钮。

添加libBox2D库引用



3、开启Box2D预编译开关
打开属性对话框中选择“配置属性”→“C/C++”→“预处理器”,接着在右边“预处理器”中找到CC_ENABLE_CHIPMUNK_INTEGRATION=1,把它修改为CC_ENABLE_BOX2D_INTEGRATION= 1。这样框架采用的物理引擎从Chipmunk改变为Box2D,如图所示。修改完后点击“确定”按钮。


开启Box2D预编译开关

 

 

 

更多内容请关注最新Cocos图书《Cocos2d-x实战 C++卷》
本书交流讨论网站:http://www.cocoagame.net
更多精彩视频课程请关注智捷课堂Cocos课程:http://v.51work6.com
欢迎加入Cocos2d-x技术讨论群:257760386


《Cocos2d-x实战 C++卷》现已上线,各大商店均已开售:

京东:http://item.jd.com/11584534.html

亚马逊:http://www.amazon.cn/Cocos2d-x%E5%AE%9E%E6%88%98-C-%E5%8D%B7-%E5%85%B3%E4%B8%9C%E5%8D%87/dp/B00PTYWTLU

当当:http://product.dangdang.com/23606265.html

互动出版网:http://product.china-pub.com/3770734

 

《Cocos2d-x实战 C++卷》源码及样章下载地址:

源码下载地址:http://51work6.com/forum.php?mod=viewthread&tid=1155&extra=page%3D1 

样章下载地址:http://51work6.com/forum.php?mod=viewthread&tid=1157&extra=page%3D1

欢迎关注智捷iOS课堂微信公共平台
分享到:
评论

相关推荐

    box2d-beef:牛肉编程语言的box2d + liquidfun包装器

    牛肉编程语言的 box2d包装器 -实际上liquidfun一个Box2D的叉合并到它! 先决条件 要初始化子模块,请运行git submodule update --init --recursive 视窗 Visual Studio 2019社区/专业(尽管可以使用其他版本构建,请...

    小型2D物理引擎-C/C++开发

    Box2D-Lite Box2D-Lite是小型2D物理引擎。 它是为2006 GDC物理教程开发的。 这是较大的Box2D库的原始版本。 精简版更适合于学习游戏物理。 Box2D-Lite Box2D-Lite是小型2D物理引擎。 它是为2006 GDC物理教程开发的。...

    ActiveReports 7 2013 V1 1/4

    With a selection including textbox, checkbox, line, shape, cross-section box, image, formatted text with mail merge, barcode (2D and 3D), chart, and other data visualization controls, they support a ...

    ShineGame:使用 XNA Framework 4.0 完全用 C# 编写的 2D 平台游戏框架

    支持物理 Box2D.XNA。 支持导入 Tiled 级别(JSON 导出格式)。 音乐和声音播放。 通过关卡中的属性对象自定义对象的属性。 演示游戏囚犯经典的 2D 平台游戏。 Visual Studio 2013 兼容性。重要的您需要安装 Visual...

    ComponentOne 2012 V2 ActiveReports 7 1/3

    With a selection including textbox, checkbox, line, shape, cross-section box, image, formatted text with mail merge, barcode (2D and 3D), chart, and other data visualization controls, they support a ...

    ComponentOne 2012 V2 ActiveReports 7(完整安装)

    With a selection including textbox, checkbox, line, shape, cross-section box, image, formatted text with mail merge, barcode (2D and 3D), chart, and other data visualization controls, they support a ...

    ComponentOne 2012 V2 ActiveReports 7 3/3

    With a selection including textbox, checkbox, line, shape, cross-section box, image, formatted text with mail merge, barcode (2D and 3D), chart, and other data visualization controls, they support a ...

    ActiveReports 7 2013 V1 3/4

    With a selection including textbox, checkbox, line, shape, cross-section box, image, formatted text with mail merge, barcode (2D and 3D), chart, and other data visualization controls, they support a ...

    ActiveReports 7 2013 V1 4/4

    With a selection including textbox, checkbox, line, shape, cross-section box, image, formatted text with mail merge, barcode (2D and 3D), chart, and other data visualization controls, they support a ...

    ActiveReports 7 2013 V1 2/4

    With a selection including textbox, checkbox, line, shape, cross-section box, image, formatted text with mail merge, barcode (2D and 3D), chart, and other data visualization controls, they support a ...

    opengl_nehe_SDK

    Microsoft Visual Studio 6 for recompilation and development, although there should be no reason why it couldn't be compiled on Borland with a few changes. MinGW gcc however has no support for ...

    Dundas.Chart.for.Winform.Enterprise.v7.1.0.1812.for.VS2008

    Side by side installation for Visual Studio 2003 & 2005 - To ensure a smooth transition between Visual Studio 2003 and Visual Studio 2005, Version 5.0 offers separate installations for each ...

    astra-toolbox:ASTRA层析成像工具箱

    ASTRA工具箱ASTRA工具箱是用于2D和3D层析成像的高性能GPU基元的MATLAB和Python工具箱。... 我们需要Microsoft Visual Studio 2015可再发行组件包。 如果您的系统上尚未安装此文件,则它将作为vc_redist.x64.

    Qt Creator 的安装和hello world 程序+其他程序的编写--不是一般的好

    在Qt Creator 的安装目录的qt 文件下的bin 文件夹下(我安装在了D 盘, 所以路径是D:\Qt\2009.04\qt\bin),可以找到所有的相关.dll 文件。在这里 找到mingwm10.dll 文件,将其复制到C:\WINDOWS\system 文件夹下,...

    网管教程 从入门到精通软件篇.txt

     bootcfg /default 设置默认引导项。  bootcfg /add 向引导列表中添加 Windows 安装。  bootcfg /rebuild 重复全部 Windows 安装过程并允许用户选择要添加的内容。  注意:使用 bootcfg /rebuild 之前,应...

    is-Engine:使用SFML库开发的游戏引擎,可以在Web(HTML 5-CSS 3),Android和PC上创建游戏

    is-Engine:使用SFML库开发的游戏引擎,可以在Web(HTML 5-CSS 3),Android和PC上创建游戏

    CodeTyphonIns2.30

    -ADD pl_Box2D, (Under modification/experimental) -ADD pl_Graphics32EXT, Extensions for Graphics32 (Win32, Win64, Linux32, Linux64, WinCE) -ADD pl_Cindy (Win32, Win64, Linux32, Linux64, WinCE) -...

Global site tag (gtag.js) - Google Analytics