Game Development Reference
In-Depth Information
#import "cocos2d.h"
#import "Box2D.h"
#import "GLES-Render.h"
#import "ContactListener.h"
@interface PinballTableLayer : CCLayer
{
b2World* world;
ContactListener* contactListener;
GLESDebugDraw* debugDraw;
}
+(id) scene;
@end
It contains references to the ContactListener and GLESDebugDraw classes.
The latter I'll get to shortly; the ContactListener class will play a role when
you're adding the pinball game's plunger. For now, look at the initialization of the
PinballTableLayer class in Listing 13-7 .
Listing 13-7 . Initialization of the PinballTableLayer Class
#import "PinballTableLayer.h"
#import "BodySprite.h"
#import "Constants.h"
#import "Helper.h"
#import "GB2ShapeCache.h"
#import "TableSetup.h"
@implementation PinballTableLayer
-(id) init
{
if ((self = [super init]))
{
// pre load the sprite frames from the texture atlas
[[CCSpriteFrameCache sharedSpriteFrameCache]←
addSpriteFramesWithFile:@"pinball.plist"];
 
 
Search Nedrilad ::




Custom Search