Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
users:shilo:extensions:shclippedsprite [2013/03/05 10:19]
127.0.0.1 external edit
users:shilo:extensions:shclippedsprite [2014/04/24 13:05] (current)
178.219.160.178 [Example]
Line 1: Line 1:
 +====== SHClippedSprite ======
 +---- dataentry extension ----
 +type            : extension
 +author_mail ​    : shilo86@gmail.com Shilo White
 +description ​    : A simple clipped sprite.
 +lastupdate_dt ​  : 2011-06-04
 +compatible ​     : v1.X
 +depends ​        : ​
 +tags            : clip, sprite, clippedsprite
 +homepage_url ​   : https://​gist.github.com/​1346513
 +download_url ​   : https://​gist.github.com/​gists/​1346513/​download
 +min iOS version : 3.2
 +----
  
 +===== Description =====
 +SHClippedSprite class will allow you to easily clip children (display objects) inside of a sprite. This class inherits all properties from SPSprite and also includes:
 +<code objc>
 +@property (nonatomic, readonly) SPQuad *clip;
 +Default properties:
 +clip.x = 0
 +clip.y = 0
 +clip.width = 0
 +clip.height = 0
 +
 +@property (nonatomic, assign) BOOL clipping;
 +Default value is NO.
 +</​code>​
 +
 +===== Sample =====
 +(Coming later)
 +
 +===== Example =====
 +<code objc>
 +SHClippedSprite *cp = [[SHClippedSprite alloc] init];
 +cp.clip.x = 5;
 +cp.clip.y = 10;
 +cp.clip.width = 100;
 +cp.clip.height = 80;
 +</​code>​
 +===== Instructions =====
 +==== To add into your Sparrow project ====
 +  - Download the source files here: [[https://​gist.github.com/​gists/​12eeb51a59aa4a0cc2ea/​download]]
 +  - Open your desired Sparrow project
 +  - Drag and drop the files into the "​Groups & Files" pane
 +  - Open "​Game.h"​
 +  - Include the extension: <code objc>#​include "​SHClippedSprite.h"</​code>​
 +  - Save "​Game.h"​
 +
 +==== To add directly into Sparrow source ====
 +  - Download the source files here: [[https://​gist.github.com/​gists/​12eeb51a59aa4a0cc2ea/​download]]
 +  - Save the files into Sparrow'​s "/​Classes/"​ directory
 +    * Example: "/​sparrow/​src/​Classes/"​
 +  - Navigate back one directory and open "​Sparrow.xcodeproj"​
 +    * Example: "/​sparrow/​src/​Sparrow.xcodeproj"​
 +  - Inside the "​Groups & Files" pane, locate the "​Display"​ group folder
 +    * Example: "​Sparrow -> Classes -> Display"​
 +  - Right click the "​Display"​ group folder and click "Add -> Existing Files.."​
 +  - Navigate into the "/​Classes/"​ directory and select "​SHClippedSprite.h"​ and "​SHClippedSprite.m",​ then click "​add"​
 +  - On the next window, leave all options as default and click "​add"​
 +  - In the "​Groups & Files" pane, Open "​Sparrow.h"​
 +    * Example "​Sparrow -> Classes -> Sparrow.h"​
 +  - At the bottom of the file, add: <code objc>#​import "​SHClippedSprite.h"</​code>​
 +  - Save "​Sparrow.h"​
 +  - Close "​Sparrow.xcodeproj"​
 +
 +===== Source Code =====
 +%gist(12eeb51a59aa4a0cc2ea)%
 +
 +===== Changelog =====
 +  * //​2011-06-04://​ First version
 +  * //​2011-06-12://​ Fixed clipped bounds.
 +
 +===== Todo =====
 +  * (Empty)
  users/shilo/extensions/shclippedsprite.txt · Last modified: 2014/04/24 13:05 by 178.219.160.178
 
Powered by DokuWiki