Code: Select all
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view from its nib.
cpInitChipmunk();
cpSpace* space = cpSpaceNew();
space->sleepTimeThreshold = INFINITY;
cpVect grav = cpv(0, GAME_GRAVITY);
cpSpaceSetGravity(space, grav);
cpSpaceSetIterations(space, SPACE_ITERATIONS);
double viewHeight = self.view.bounds.size.height;
double viewWidth = self.view.bounds.size.width;
cpBody* rbound = cpBodyNewStatic();
cpBody* lbound = cpBodyNewStatic();
cpShape* lboundShape = cpSegmentShapeNew(lbound, cpv(0,0), cpv(0,viewHeight),0);
cpShape* rboundShape = cpSegmentShapeNew(rbound, cpv(viewWidth,0), cpv(viewWidth,viewHeight), 0);
cpShapeSetElasticity(lboundShape, 0.2);
cpShapeSetElasticity(rboundShape, 0.2);
cpShapeSetFriction(lboundShape, 0);
cpShapeSetFriction(rboundShape, 0);
cpSpaceAddShape(space,rboundShape);
cpSpaceAddShape(space, lboundShape);
}
Code: Select all
0 leafSetTrans
1 cpBBTreeInsert
2 cpSpaceAddStaticShape
3 cpSpaceAddShape
4 -[PPTestViewController viewDidLoad]
I couldn't find anything with Google that was helpful, so hopefully someone here can point me in the right direction. Some kind of compiler setting maybe?