1 BOOL SmashPcMap::Draw(cpBody *PlayerBody) 2 { 3 cpFloat LeftX = PlayerBody->p.x - mu32ScreenWidth/2; 4 cpFloat TopY = PlayerBody->p.y - mu32ScreenHeight/2; 5 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 sf::Shape oShape; 13 14 if (it->bIsRect) 15 { 16 17 18 oShape = sf::Shape::Rectangle (it->StartingPoint.x - LeftX, it->StartingPoint.y - TopY, 19 it->EndingPoint.x - it->StartingPoint.x, 20 it->EndingPoint.y - it->StartingPoint.y, 21 sf::Color(128, 128, 128, 255)); 22 23 } 24 else 25 { 26 oShape = sf::Shape::Line(it->StartingPoint.x - LeftX, it->StartingPoint.y - TopY, 27 it->EndingPoint.x - LeftX, it->EndingPoint.y - TopY, 28 10, sf::Color(128, 128, 128, 255)); 29 } 30 mpApp->Draw(oShape); 31 } 32 33 // draw all the items 34 std::vector::iterator ItemIt; 35 for (ItemIt = ItemList.begin(); ItemIt != ItemList.end(); ItemIt++) 36 { 37 (*ItemIt)->Draw(PlayerBody->p); 38 } 39 40 return TRUE; 41 }