SHClippedSprite
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
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
-
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
-
Save the files into Sparrow's “/Classes/” directory
Navigate back one directory and open “Sparrow.xcodeproj”
Inside the “Groups & Files” pane, locate the “Display” group folder
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”
At the bottom of the file, add:
#import "SHClippedSprite.h"
Save “Sparrow.h”
Close “Sparrow.xcodeproj”
Source Code
Changelog
Todo