¡@

Home 

2014/10/15 ¤U¤È 10:04:42

iphone Programming Glossary: boundingbox

how to obtain a CCSprite's width and height in cocos2d for iphone

http://stackoverflow.com/questions/2503903/how-to-obtain-a-ccsprites-width-and-height-in-cocos2d-for-iphone

class has a bounding box property that's a CGRect CCSprite sprite CCSprite spriteWithFile @ file.png int width sprite boundingBox .size.width I added a width and height methods to my CCSprite subclass. CGFloat width return self boundingBox .size.width..

Create layer mask with custom-shaped hole

http://stackoverflow.com/questions/5721196/create-layer-mask-with-custom-shaped-hole

path UIBezierPath bezierPathWithRect rectHole CAShapeLayer maskLayer CAShapeLayer layer maskLayer.bounds spr boundingBox maskLayer.position spr.position maskLayer.fillColor UIColor whiteColor .CGColor maskLayer.backgroundColor UIColor clearColor.. UIColor clearColor .CGColor maskLayer.path path.CGPath CALayer colorLayer CALayer layer colorLayer.bounds spr boundingBox colorLayer.position maskLayer.position colorLayer setMask maskLayer CCDirector sharedDirector openGLView layer addSublayer.. path UIBezierPath bezierPathWithRect rectHole CAShapeLayer maskLayer CAShapeLayer layer maskLayer.bounds spr boundingBox maskLayer.position spr.position maskLayer.fillColor UIColor whiteColor .CGColor maskLayer.backgroundColor UIColor clearColor..