Game Development Reference
@interface HelloWorldLayer : CCLayer
It's fairly standard, except that it includes the Box2D.h header file and adds a member
variable of type b2World . This is the physics world—think of it as the container class
that will store and update all physics bodies.
The init method in Listing 12-2 calls initPhysics to set up the physics world.
I'll get to that next. The rest of the init code creates a CCSpriteBatchNode ,
keeps a reference to the sprite batch texture, and adds a label to the screen. Notice that
the dealloc method calls delete on the world and debugDraw instance variables.
Because these are C++ class instances, you have to release (delete) them manually.
ARC does not manage memory of C or C++ objects.
Listing 12-2. The HelloWorldLayer initialization
CCScene* scene = [CCScene node];
HelloWorldLayer* layer = [HelloWorldLayer node];
[scene addChild: layer];