cocos2d-x中 Box2D 加入debugDraw
来源:互联网 发布:齐鲁商品软件下载 编辑:程序博客网 时间:2024/04/29 03:04
1 cocos2d中testcpp->box2dTestBed文件夹,下面有GLES-Render.h/GLES-Render.cpp,这两个文件先要拷到你的项目中
2 在你的helloworldscene.h中创建 GLESDebugDraw *m_DebugDraw 对象 再写个 void draw()方法
3 在helloworldscene.cpp中 init()函数里:
//PTM_RATIO是box2d中单位米和像素转换比率 #define PTM_RATIO 32
m_DebugDraw = new GLESDebugDraw(PTM_RATIO);
//m_World 是世界对象
m_World->SetDebugDraw(m_DebugDraw);
uint32 flags = 0;
flags += b2Draw::e_shapeBit;
m_DebugDraw->SetFlags(flags);
draw();
4 在helloworldscene.cpp中 定义刚写的void draw()方法
void HelloWorld::draw()
{
CCLayer::draw();
ccGLEnableVertexAttribs( kCCVertexAttribFlag_Position );
kmGLPushMatrix();
m_World->DrawDebugData();//这个是一定要写的 其他几句不知道啥意思 看别人代码抄的
kmGLPopMatrix();
CHECK_GL_ERROR_DEBUG();
}
2 在你的helloworldscene.h中创建 GLESDebugDraw *m_DebugDraw 对象 再写个 void draw()方法
3 在helloworldscene.cpp中 init()函数里:
//PTM_RATIO是box2d中单位米和像素转换比率 #define PTM_RATIO 32
m_DebugDraw = new GLESDebugDraw(PTM_RATIO);
//m_World 是世界对象
m_World->SetDebugDraw(m_DebugDraw);
uint32 flags = 0;
flags += b2Draw::e_shapeBit;
m_DebugDraw->SetFlags(flags);
draw();
4 在helloworldscene.cpp中 定义刚写的void draw()方法
void HelloWorld::draw()
{
CCLayer::draw();
ccGLEnableVertexAttribs( kCCVertexAttribFlag_Position );
kmGLPushMatrix();
m_World->DrawDebugData();//这个是一定要写的 其他几句不知道啥意思 看别人代码抄的
kmGLPopMatrix();
CHECK_GL_ERROR_DEBUG();
}
0 0
- cocos2d-x中 Box2D 加入debugDraw
- Cocos2d-x Box2D debugDraw
- cocos2d-x box2d debugdraw
- Cocos2d-x Box2D debugDraw
- cocos2d-x中使用DebugDraw提高box2d开发效率
- cocos2d-x 3.x box2d显示debugDraw
- cocos2d-x中使用box2d物理引擎时,开启debugDraw的方法
- cocos2d-x中,怎么开启debugDraw?
- [ IOS-Cocos2d-x (Box2d)游戏开发之二] -Box2D如何开启debugDraw
- cocos2d-x 3.x 开启debugdraw
- cocs2d-x box2d debugdraw的显示层次问题
- cocos2d-x中box2d的关节
- cocos2dx box2d 添加debugDraw
- cocos2dx box2d 添加debugDraw
- Box2D C++ DebugDraw
- cocos2dx3.4 BOX2D debugdraw
- cocos2d-x box2d 示例
- cocos2d-x box2d 入门
- 对于STM32使用FSMC驱动传统8080并口器件方式(TFT)的理解(上)
- discuzx数据调用分析
- JAVA基础之Pattern\Matcher 组合
- 关于C#是不是脚本语言的问题
- mfc简易计算器,Cstring转double
- cocos2d-x中 Box2D 加入debugDraw
- Perl函数参数中传递数组和引用的使用
- java编程思想读书笔记-4
- MATLAB图像中添加标记
- include jsp 公共jsp
- Android 自定义ListView实现底部分页刷新与顶部下拉刷新
- cisco交换机配置vlan的资料
- Perl 的 html 解析模块
- matlab自定义窗口名