====== 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: @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. ===== Sample ===== (Coming later) ===== Example ===== SHClippedSprite *cp = [[SHClippedSprite alloc] init]; cp.clip.x = 5; cp.clip.y = 10; cp.clip.width = 100; cp.clip.height = 80; ===== 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: #include "SHClippedSprite.h" - 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: #import "SHClippedSprite.h" - Save "Sparrow.h" - Close "Sparrow.xcodeproj" ===== Source Code ===== %gist(12eeb51a59aa4a0cc2ea)% ===== Changelog ===== * //2011-06-04:// First version * //2011-06-12:// Fixed clipped bounds. ===== Todo ===== * (Empty)