This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
extensions:masked_sprite [2014/04/09 16:48] – daniel | extensions:masked_sprite [2015/09/14 11:15] (current) – external edit 127.0.0.1 | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ~~NOTOC~~ | ||
+ | ====== SXMaskedSprite ====== | ||
+ | |||
+ | ---- dataentry extension ---- | ||
+ | author_mail | ||
+ | description | ||
+ | lastupdate_dt : 2014-04-09 # the date you created the extension | ||
+ | compatible | ||
+ | depends | ||
+ | tags : mask # enter a few tags, separated by commas | ||
+ | homepage_url | ||
+ | download_url | ||
+ | ---- | ||
+ | |||
+ | ===== Overview ===== | ||
+ | |||
+ | {{ : | ||
+ | |||
+ | The Sparrow Extension class " | ||
+ | |||
+ | Use the class as a replacement for a normal Sprite. It contains a public property called " | ||
+ | |||
+ | ===== Installation ===== | ||
+ | |||
+ | Add the class files from the src-directory to your Sparrow-powered game. | ||
+ | |||
+ | ===== Demo-Project ====== | ||
+ | |||
+ | The demo-directory contains a sample project. If you have configured your system for Sparrow, the project should compile and run out of the box. | ||
+ | |||
+ | ===== Sample Code ===== | ||
+ | |||
+ | Create the sprite class and attach any display object to it, and it will act as a mask. There is no need to add the mask to the display list; you can change its position, scale, alpha, etc. to achieve different effects. | ||
+ | |||
+ | <code objc> | ||
+ | // create masked sprite and add some children | ||
+ | SXMaskedSprite *sprite = [SXMaskedSprite sprite]; | ||
+ | [sprite addChild: | ||
+ | |||
+ | // create a mask | ||
+ | SPImage *mask = [SPImage imageWithContentsOfFile: | ||
+ | |||
+ | // apply the mask to the sprite | ||
+ | sprite.mask = mask; | ||
+ | </ | ||
+ | |||
+ | ===== More information ===== | ||
+ | |||
+ | Special thanks to Jonathan Hart — his [[http:// | ||
+ | |||
+ | ===== Discussion ===== | ||
+ | |||
+ | //No comments so far. Feel free to edit this part of the page.// |