1 void SmashPcMap::CreateSpace(void) 2 { 3 GameLevel::tLevelItem LevelItem; 4 GameLevel::tLevelWall LevelWall; 5 cpShape *pShape; 6 std::vector::iterator it; 7 8 /* loop through all the walls 1st and draw them */ 9 for (it = mpLevel->mWalls.begin(); 10 it != mpLevel->mWalls.end(); it++) 11 { 12 if (it->bIsRect) 13 { 14 cpVect Verts[4] = {{it->StartingPoint.x, it->StartingPoint.y}, 15 {it->StartingPoint.x, it->EndingPoint.y}, 16 {it->EndingPoint.x, it->EndingPoint.y}, 17 {it->EndingPoint.x, it->StartingPoint.y} }; 18 19 pShape = cpSpaceAddShape(mpSpace, cpPolyShapeNew(&mpSpace->staticBody, 4, Verts, cpvzero)); 20 } 21 else 22 { 23 pShape = cpSpaceAddShape(mpSpace, cpSegmentShapeNew(&mpSpace->staticBody, it->StartingPoint, it->EndingPoint, 10.0f)); 24 } 25 26 pShape->e = 0.0f;//9f; 27 pShape->u = 0.0f;//3f; 28 pShape->collision_type = WALL_COL_TYPE; 29 pShape->data = this; 30 // Walls occupy all layers 31 } 32 33 }