Game Development Reference
In-Depth Information
Documentation for Box2D is available in several places. First, you can read the Box2D
manual online at www.box2d.org/manual.html , which introduces you to com-
mon concepts and shows example code. The Box2D API reference is distributed with
Box2D itself, which you can download at http://code.google.com/p/
box2d . You can also find the Box2D API reference in the Box2D version distributed
with the topic's source code. The API reference is in the folder /Physics Engine
Libraries/Box2D_v2.1.2/Box2D/Documentation/API —to view it, loc-
ate and open the file index.html in that folder. You can also browse the Box2D API
reference (and other libraries) for the version included in Kobold2D by visiting this
URL: www.learn-cocos2d.com/api-ref .
If you like Box2D, you should also consider donating to the project; you can do so via
the Donate button on its home page: www.box2d.org .
The World According to Box2D
Because the Box2D example project provided by cocos2d is quite complex, I decided
to break it down into smaller pieces and re-create the example project step by step, but
not without adding some extras and variations.
Listing 12-1 shows the HelloWorldLayer header file from the PhysicsBox2D01
project.
Listing 12-1. The Box2D HelloWorldLayer Interface
#import "cocos2d.h"
#import "Box2D.h"
#import "GLES-Render.h"
#define PTM_RATIO 32
#define TILESIZE 32
#define TILESET_COLUMNS 9
#define TILESET_ROWS 19
enum
{
kTagBatchNode,
 
 
Search Nedrilad ::




Custom Search