O'Reilly logo

Cocos2d-x by Example : Beginner's Guide - Second Edition by Roger Engelbert

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Time for action – using debug draw in your Box2D project

Let's start by creating the project. In my machine, I created a game called MiniPool in my desktop. Here are the steps:

  1. Open Terminal and enter the following command:
    cocos new MiniPool -p com.rengelbert.MiniPool -l cpp -d /Users/rengelbert/Desktop/MiniPool
  2. Open the new project in Xcode.
  3. Now navigate to the Tests folder inside the Cocos2d-x framework folder. This can be found in tests/cpp-tests/Classes. Then open the Box2DTestBed folder.
  4. Drag the files GLES-Render.h and GLES-Render.cpp to your project in Xcode.
  5. You can also open the Box2dTest.cpp class in the test folder Box2DTest, as we're going to copy and paste a few of the methods from there.
  6. In the HelloWorldScene.h header file, leave the ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required