├── CocoParticle.xcodeproj └── project.pbxproj ├── CocoParticle ├── AppDelegate.h ├── AppDelegate.m ├── DropboxSDK │ ├── DBAccountInfo.h │ ├── DBAccountInfo.m │ ├── DBCreateAccountController.h │ ├── DBCreateAccountController.m │ ├── DBError.h │ ├── DBError.m │ ├── DBLoadingView.h │ ├── DBLoadingView.m │ ├── DBLoginController.h │ ├── DBLoginController.m │ ├── DBMetadata.h │ ├── DBMetadata.m │ ├── DBQuota.h │ ├── DBQuota.m │ ├── DBRequest.h │ ├── DBRequest.m │ ├── DBRestClient.h │ ├── DBRestClient.m │ ├── DBSession.h │ ├── DBSession.m │ ├── DropboxSDK.h │ ├── JSON │ │ ├── JSON.h │ │ ├── NSObject+SBJSON.h │ │ ├── NSObject+SBJSON.m │ │ ├── NSString+SBJSON.h │ │ ├── NSString+SBJSON.m │ │ ├── SBJSON.h │ │ ├── SBJSON.m │ │ ├── SBJsonBase.h │ │ ├── SBJsonBase.m │ │ ├── SBJsonParser.h │ │ ├── SBJsonParser.m │ │ ├── SBJsonWriter.h │ │ └── SBJsonWriter.m │ ├── MPOAuth │ │ ├── Crypto │ │ │ ├── Base64Transcoder.c │ │ │ └── Base64Transcoder.h │ │ ├── MPDebug.h │ │ ├── MPOAuth.h │ │ ├── MPOAuthAPI.h │ │ ├── MPOAuthAPI.m │ │ ├── MPOAuthAPIRequestLoader.h │ │ ├── MPOAuthAPIRequestLoader.m │ │ ├── MPOAuthAuthenticationMethod.h │ │ ├── MPOAuthAuthenticationMethod.m │ │ ├── MPOAuthAuthenticationMethodOAuth.h │ │ ├── MPOAuthAuthenticationMethodOAuth.m │ │ ├── MPOAuthConnection.h │ │ ├── MPOAuthConnection.m │ │ ├── MPOAuthCredentiaIConcreteStore+KeychainAdditionsMac.m │ │ ├── MPOAuthCredentialConcreteStore+KeychainAdditions.h │ │ ├── MPOAuthCredentialConcreteStore+KeychainAdditionsiPhone.m │ │ ├── MPOAuthCredentialConcreteStore.h │ │ ├── MPOAuthCredentialConcreteStore.m │ │ ├── MPOAuthCredentialStore.h │ │ ├── MPOAuthParameterFactory.h │ │ ├── MPOAuthSignatureParameter.h │ │ ├── MPOAuthSignatureParameter.m │ │ ├── MPOAuthURLRequest.h │ │ ├── MPOAuthURLRequest.m │ │ ├── MPOAuthURLResponse.h │ │ ├── MPOAuthURLResponse.m │ │ ├── MPURLRequestParameter.h │ │ ├── MPURLRequestParameter.m │ │ ├── NSString+URLEscapingAdditions.h │ │ ├── NSString+URLEscapingAdditions.m │ │ ├── NSURL+MPURLParameterAdditions.h │ │ ├── NSURL+MPURLParameterAdditions.m │ │ ├── NSURLResponse+Encoding.h │ │ └── NSURLResponse+Encoding.m │ ├── NSString+Dropbox.h │ ├── NSString+Dropbox.m │ └── Resources │ │ ├── db_background.png │ │ ├── db_create_account.png │ │ ├── db_create_account@2x.png │ │ ├── db_create_account_button.png │ │ ├── db_create_account_button_down.png │ │ ├── db_link_button.png │ │ ├── db_link_button_down.png │ │ ├── db_link_header.png │ │ ├── db_link_header@2x.png │ │ ├── db_logo.png │ │ └── db_logo@2x.png ├── GameConfig.h ├── HelloWorldLayer.h ├── HelloWorldLayer.m ├── ParticleConfig.h ├── ParticleEditor.h ├── ParticleEditor.m ├── ParticleEditorComponent.h ├── ParticleEditorComponent.m ├── ParticleEditorComponentManager.h ├── ParticleEditorComponentManager.m ├── ParticleEditorSection.h ├── ParticleEditorSection.m ├── ParticleList.h ├── ParticleList.m ├── ParticlePreview.h ├── ParticlePreview.m ├── Prefix.pch ├── Resources │ ├── Default.png │ ├── Icon-72.png │ ├── Icon-Small-50.png │ ├── Icon-Small.png │ ├── Icon-Small@2x.png │ ├── Icon.png │ ├── Icon@2x.png │ ├── Info.plist │ ├── fire.png │ ├── fps_images.png │ └── iTunesArtwork ├── RootViewController.h ├── RootViewController.m ├── applications_app.png ├── brush_painting.png ├── db.png ├── fireworks.plist ├── galaxy.plist ├── libs │ ├── CocosDenshion │ │ ├── CDAudioManager.h │ │ ├── CDAudioManager.m │ │ ├── CDConfig.h │ │ ├── CDOpenALSupport.h │ │ ├── CDOpenALSupport.m │ │ ├── CocosDenshion.h │ │ ├── CocosDenshion.m │ │ ├── SimpleAudioEngine.h │ │ └── SimpleAudioEngine.m │ ├── FontLabel │ │ ├── FontLabel.h │ │ ├── FontLabel.m │ │ ├── FontLabelStringDrawing.h │ │ ├── FontLabelStringDrawing.m │ │ ├── FontManager.h │ │ ├── FontManager.m │ │ ├── ZAttributedString.h │ │ ├── ZAttributedString.m │ │ ├── ZAttributedStringPrivate.h │ │ ├── ZFont.h │ │ └── ZFont.m │ ├── LICENSE_CocosDenshion.txt │ ├── LICENSE_FontLabel.txt │ ├── LICENSE_TouchJSON.txt │ ├── LICENSE_cocos2d.txt │ ├── TouchJSON │ │ ├── CDataScanner.h │ │ ├── CDataScanner.m │ │ ├── Extensions │ │ │ ├── CDataScanner_Extensions.h │ │ │ ├── CDataScanner_Extensions.m │ │ │ ├── NSDictionary_JSONExtensions.h │ │ │ └── NSDictionary_JSONExtensions.m │ │ └── JSON │ │ │ ├── CJSONDeserializer.h │ │ │ ├── CJSONDeserializer.m │ │ │ ├── CJSONScanner.h │ │ │ ├── CJSONScanner.m │ │ │ ├── CJSONSerializer.h │ │ │ ├── CJSONSerializer.m │ │ │ └── JSONRepresentation.h │ ├── cocos2d │ │ ├── CCAction.h │ │ ├── CCAction.m │ │ ├── CCActionCamera.h │ │ ├── CCActionCamera.m │ │ ├── CCActionEase.h │ │ ├── CCActionEase.m │ │ ├── CCActionGrid.h │ │ ├── CCActionGrid.m │ │ ├── CCActionGrid3D.h │ │ ├── CCActionGrid3D.m │ │ ├── CCActionInstant.h │ │ ├── CCActionInstant.m │ │ ├── CCActionInterval.h │ │ ├── CCActionInterval.m │ │ ├── CCActionManager.h │ │ ├── CCActionManager.m │ │ ├── CCActionPageTurn3D.h │ │ ├── CCActionPageTurn3D.m │ │ ├── CCActionProgressTimer.h │ │ ├── CCActionProgressTimer.m │ │ ├── CCActionTiledGrid.h │ │ ├── CCActionTiledGrid.m │ │ ├── CCActionTween.h │ │ ├── CCActionTween.m │ │ ├── CCAnimation.h │ │ ├── CCAnimation.m │ │ ├── CCAnimationCache.h │ │ ├── CCAnimationCache.m │ │ ├── CCAtlasNode.h │ │ ├── CCAtlasNode.m │ │ ├── CCBlockSupport.h │ │ ├── CCBlockSupport.m │ │ ├── CCCamera.h │ │ ├── CCCamera.m │ │ ├── CCConfiguration.h │ │ ├── CCConfiguration.m │ │ ├── CCDirector.h │ │ ├── CCDirector.m │ │ ├── CCDrawingPrimitives.h │ │ ├── CCDrawingPrimitives.m │ │ ├── CCGrabber.h │ │ ├── CCGrabber.m │ │ ├── CCGrid.h │ │ ├── CCGrid.m │ │ ├── CCLabelAtlas.h │ │ ├── CCLabelAtlas.m │ │ ├── CCLabelBMFont.h │ │ ├── CCLabelBMFont.m │ │ ├── CCLabelTTF.h │ │ ├── CCLabelTTF.m │ │ ├── CCLayer.h │ │ ├── CCLayer.m │ │ ├── CCMenu.h │ │ ├── CCMenu.m │ │ ├── CCMenuItem.h │ │ ├── CCMenuItem.m │ │ ├── CCMotionStreak.h │ │ ├── CCMotionStreak.m │ │ ├── CCNode.h │ │ ├── CCNode.m │ │ ├── CCParallaxNode.h │ │ ├── CCParallaxNode.m │ │ ├── CCParticleExamples.h │ │ ├── CCParticleExamples.m │ │ ├── CCParticleSystem.h │ │ ├── CCParticleSystem.m │ │ ├── CCParticleSystemPoint.h │ │ ├── CCParticleSystemPoint.m │ │ ├── CCParticleSystemQuad.h │ │ ├── CCParticleSystemQuad.m │ │ ├── CCProgressTimer.h │ │ ├── CCProgressTimer.m │ │ ├── CCProtocols.h │ │ ├── CCRenderTexture.h │ │ ├── CCRenderTexture.m │ │ ├── CCRibbon.h │ │ ├── CCRibbon.m │ │ ├── CCScene.h │ │ ├── CCScene.m │ │ ├── CCScheduler.h │ │ ├── CCScheduler.m │ │ ├── CCSprite.h │ │ ├── CCSprite.m │ │ ├── CCSpriteBatchNode.h │ │ ├── CCSpriteBatchNode.m │ │ ├── CCSpriteFrame.h │ │ ├── CCSpriteFrame.m │ │ ├── CCSpriteFrameCache.h │ │ ├── CCSpriteFrameCache.m │ │ ├── CCTMXLayer.h │ │ ├── CCTMXLayer.m │ │ ├── CCTMXObjectGroup.h │ │ ├── CCTMXObjectGroup.m │ │ ├── CCTMXTiledMap.h │ │ ├── CCTMXTiledMap.m │ │ ├── CCTMXXMLParser.h │ │ ├── CCTMXXMLParser.m │ │ ├── CCTexture2D.h │ │ ├── CCTexture2D.m │ │ ├── CCTextureAtlas.h │ │ ├── CCTextureAtlas.m │ │ ├── CCTextureCache.h │ │ ├── CCTextureCache.m │ │ ├── CCTexturePVR.h │ │ ├── CCTexturePVR.m │ │ ├── CCTileMapAtlas.h │ │ ├── CCTileMapAtlas.m │ │ ├── CCTransition.h │ │ ├── CCTransition.m │ │ ├── CCTransitionPageTurn.h │ │ ├── CCTransitionPageTurn.m │ │ ├── CCTransitionRadial.h │ │ ├── CCTransitionRadial.m │ │ ├── Platforms │ │ │ ├── CCGL.h │ │ │ ├── CCNS.h │ │ │ ├── Mac │ │ │ │ ├── CCDirectorMac.h │ │ │ │ ├── CCDirectorMac.m │ │ │ │ ├── CCEventDispatcher.h │ │ │ │ ├── CCEventDispatcher.m │ │ │ │ ├── MacGLView.h │ │ │ │ ├── MacGLView.m │ │ │ │ ├── MacWindow.h │ │ │ │ └── MacWindow.m │ │ │ └── iOS │ │ │ │ ├── CCDirectorIOS.h │ │ │ │ ├── CCDirectorIOS.m │ │ │ │ ├── CCTouchDelegateProtocol.h │ │ │ │ ├── CCTouchDispatcher.h │ │ │ │ ├── CCTouchDispatcher.m │ │ │ │ ├── CCTouchHandler.h │ │ │ │ ├── CCTouchHandler.m │ │ │ │ ├── EAGLView.h │ │ │ │ ├── EAGLView.m │ │ │ │ ├── ES1Renderer.h │ │ │ │ ├── ES1Renderer.m │ │ │ │ ├── ESRenderer.h │ │ │ │ ├── glu.c │ │ │ │ └── glu.h │ │ ├── Support │ │ │ ├── CCArray.h │ │ │ ├── CCArray.m │ │ │ ├── CCFileUtils.h │ │ │ ├── CCFileUtils.m │ │ │ ├── CCProfiling.h │ │ │ ├── CCProfiling.m │ │ │ ├── CGPointExtension.h │ │ │ ├── CGPointExtension.m │ │ │ ├── OpenGL_Internal.h │ │ │ ├── TGAlib.h │ │ │ ├── TGAlib.m │ │ │ ├── TransformUtils.h │ │ │ ├── TransformUtils.m │ │ │ ├── ZipUtils.h │ │ │ ├── ZipUtils.m │ │ │ ├── base64.c │ │ │ ├── base64.h │ │ │ ├── ccCArray.h │ │ │ ├── ccUtils.c │ │ │ ├── ccUtils.h │ │ │ ├── uthash.h │ │ │ └── utlist.h │ │ ├── ccConfig.h │ │ ├── ccMacros.h │ │ ├── ccTypes.h │ │ ├── cocos2d.h │ │ └── cocos2d.m │ └── cocoslive │ │ ├── CLScoreServerPost.h │ │ ├── CLScoreServerPost.m │ │ ├── CLScoreServerRequest.h │ │ ├── CLScoreServerRequest.m │ │ ├── cocoslive.h │ │ └── cocoslive.m ├── list_lines.png ├── main.m ├── preferences_gear_2.png ├── preferences_gear_5.png └── preferences_settings.png ├── DropBoxVC.h ├── DropBoxVC.m ├── README ├── TSParticleSystemQuad.h ├── TSParticleSystemQuad.m ├── ss1.PNG └── ss2.PNG /CocoParticle/AppDelegate.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import "DropboxSDK.h" 3 | 4 | @class RootViewController; 5 | 6 | @interface AppDelegate : NSObject { 7 | UIWindow* window; 8 | UISplitViewController* splitVC; 9 | RootViewController* mainVC; 10 | UITabBarController* leftVC; 11 | DBRestClient* m_dbRestClient; 12 | } 13 | 14 | @property (nonatomic, retain) UIWindow *window; 15 | @property (nonatomic, readonly, assign) RootViewController* mainVC; 16 | 17 | -(void) setupDropboxSession; 18 | 19 | @end 20 | -------------------------------------------------------------------------------- /CocoParticle/DropboxSDK/DBAccountInfo.h: -------------------------------------------------------------------------------- 1 | // 2 | // DBAccountInfo.h 3 | // DropboxSDK 4 | // 5 | // Created by Brian Smith on 5/3/10. 6 | // Copyright 2010 Dropbox, Inc. All rights reserved. 7 | // 8 | 9 | 10 | #import "DBQuota.h" 11 | 12 | @interface DBAccountInfo : NSObject { 13 | NSString* country; 14 | NSString* displayName; 15 | DBQuota* quota; 16 | NSString* userId; 17 | NSString* referralLink; 18 | } 19 | 20 | - (id)initWithDictionary:(NSDictionary*)dict; 21 | 22 | @property (nonatomic, readonly) NSString* country; 23 | @property (nonatomic, readonly) NSString* displayName; 24 | @property (nonatomic, readonly) DBQuota* quota; 25 | @property (nonatomic, readonly) NSString* userId; 26 | @property (nonatomic, readonly) NSString* referralLink; 27 | 28 | @end 29 | -------------------------------------------------------------------------------- /CocoParticle/DropboxSDK/DBAccountInfo.m: -------------------------------------------------------------------------------- 1 | // 2 | // DBAccountInfo.m 3 | // DropboxSDK 4 | // 5 | // Created by Brian Smith on 5/3/10. 6 | // Copyright 2010 Dropbox, Inc. All rights reserved. 7 | // 8 | 9 | #import "DBAccountInfo.h" 10 | 11 | 12 | @implementation DBAccountInfo 13 | 14 | - (id)initWithDictionary:(NSDictionary*)dict { 15 | if ((self = [super init])) { 16 | country = [[dict objectForKey:@"country"] retain]; 17 | displayName = [[dict objectForKey:@"display_name"] retain]; 18 | quota = [[DBQuota alloc] initWithDictionary:[dict objectForKey:@"quota_info"]]; 19 | userId = [[[dict objectForKey:@"uid"] stringValue] retain]; 20 | referralLink = [[dict objectForKey:@"referral_link"] retain]; 21 | } 22 | return self; 23 | } 24 | 25 | - (void)dealloc { 26 | [country release]; 27 | [displayName release]; 28 | [quota release]; 29 | [userId release]; 30 | [referralLink release]; 31 | [super dealloc]; 32 | } 33 | 34 | @synthesize country; 35 | @synthesize displayName; 36 | @synthesize quota; 37 | @synthesize userId; 38 | @synthesize referralLink; 39 | 40 | 41 | #pragma mark NSCoding methods 42 | 43 | - (void)encodeWithCoder:(NSCoder*)coder { 44 | [coder encodeObject:country forKey:@"country"]; 45 | [coder encodeObject:displayName forKey:@"displayName"]; 46 | [coder encodeObject:quota forKey:@"quota"]; 47 | [coder encodeObject:userId forKey:@"userId"]; 48 | [coder encodeObject:referralLink forKey:@"referralLink"]; 49 | } 50 | 51 | - (id)initWithCoder:(NSCoder*)coder { 52 | self = [super init]; 53 | country = [[coder decodeObjectForKey:@"country"] retain]; 54 | displayName = [[coder decodeObjectForKey:@"displayName"] retain]; 55 | quota = [[coder decodeObjectForKey:@"quota"] retain]; 56 | userId = [[coder decodeObjectForKey:@"userId"] retain]; 57 | referralLink = [[coder decodeObjectForKey:@"referralLink"] retain]; 58 | return self; 59 | } 60 | 61 | @end 62 | -------------------------------------------------------------------------------- /CocoParticle/DropboxSDK/DBCreateAccountController.h: -------------------------------------------------------------------------------- 1 | // 2 | // DBCreateAccountController.h 3 | // DropboxSDK 4 | // 5 | // Created by Brian Smith on 5/20/10. 6 | // Copyright 2010 Dropbox, Inc. All rights reserved. 7 | // 8 | 9 | 10 | @class DBLoadingView; 11 | @class DBLoginController; 12 | @class DBRestClient; 13 | 14 | @interface DBCreateAccountController : UIViewController { 15 | BOOL hasCreatedAccount; 16 | DBLoginController* loginController; 17 | DBRestClient* restClient; 18 | 19 | UITableView* tableView; 20 | UIView* headerView; 21 | UITableViewCell* firstNameCell; 22 | UITextField* firstNameField; 23 | UITableViewCell* lastNameCell; 24 | UITextField* lastNameField; 25 | UITableViewCell* emailCell; 26 | UITextField* emailField; 27 | UITableViewCell* passwordCell; 28 | UITextField* passwordField; 29 | UIView* footerView; 30 | UIActivityIndicatorView* activityIndicator; 31 | DBLoadingView* loadingView; 32 | } 33 | 34 | @property (nonatomic, assign) DBLoginController* loginController; 35 | 36 | @end 37 | -------------------------------------------------------------------------------- /CocoParticle/DropboxSDK/DBError.h: -------------------------------------------------------------------------------- 1 | // 2 | // DBError.h 3 | // DropboxSDK 4 | // 5 | // Created by Brian Smith on 7/21/10. 6 | // Copyright 2010 Dropbox, Inc. All rights reserved. 7 | // 8 | 9 | /* This file contains error codes and the dropbox error domain */ 10 | 11 | extern NSString* DBErrorDomain; 12 | 13 | // Error codes in the dropbox.com domain represent the HTTP status code if less than 1000 14 | typedef enum { 15 | DBErrorNone = 0, 16 | DBErrorGenericError = 1000, 17 | DBErrorFileNotFound, 18 | DBErrorInsufficientDiskSpace, 19 | } DBErrorCode; 20 | -------------------------------------------------------------------------------- /CocoParticle/DropboxSDK/DBError.m: -------------------------------------------------------------------------------- 1 | // 2 | // DBError.m 3 | // DropboxSDK 4 | // 5 | // Created by Brian Smith on 7/21/10. 6 | // Copyright 2010 Dropbox, Inc. All rights reserved. 7 | // 8 | 9 | #import "DBError.h" 10 | 11 | NSString* DBErrorDomain = @"dropbox.com"; 12 | -------------------------------------------------------------------------------- /CocoParticle/DropboxSDK/DBLoadingView.h: -------------------------------------------------------------------------------- 1 | // 2 | // DBLoadingView.h 3 | // DropboxSDK 4 | // 5 | // Created by Brian Smith on 6/30/10. 6 | // Copyright 2010 Dropbox, Inc. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | 12 | @interface DBLoadingView : UIView { 13 | UIInterfaceOrientation orientation; 14 | UILabel* titleLabel; 15 | UIActivityIndicatorView* activityIndicator; 16 | UIImageView* imageView; 17 | } 18 | 19 | - (id)initWithTitle:(NSString*)title; 20 | 21 | - (void)setImage:(UIImage*)image; 22 | - (void)setOrientation:(UIInterfaceOrientation)orientation; 23 | 24 | - (void)show; 25 | - (void)dismissAnimated:(BOOL)animated; 26 | 27 | //@property (nonatomic, retain) NSString* title; 28 | 29 | @end 30 | -------------------------------------------------------------------------------- /CocoParticle/DropboxSDK/DBLoginController.h: -------------------------------------------------------------------------------- 1 | // 2 | // DBLoginController.h 3 | // DropboxSDK 4 | // 5 | // Created by Brian Smith on 5/20/10. 6 | // Copyright 2010 Dropbox, Inc. All rights reserved. 7 | // 8 | 9 | 10 | @class DBLoadingView; 11 | @class DBRestClient; 12 | @protocol DBLoginControllerDelegate; 13 | 14 | @interface DBLoginController : UIViewController { 15 | BOOL hasAppeared; // Used to track whether the view totally onscreen 16 | id delegate; 17 | 18 | UITableView* tableView; 19 | UILabel* descriptionLabel; 20 | UITableViewCell* emailCell; 21 | UITextField* emailField; 22 | UITableViewCell* passwordCell; 23 | UITextField* passwordField; 24 | UIView* footerView; 25 | 26 | DBLoadingView* loadingView; 27 | UIActivityIndicatorView* activityIndicator; 28 | 29 | DBRestClient* restClient; 30 | } 31 | 32 | - (void)presentFromController:(UIViewController*)controller; 33 | 34 | @property (nonatomic, assign) id delegate; 35 | 36 | @end 37 | 38 | 39 | // This controller tells the delegate whether the user sucessfully logged in or not 40 | // The login controller will dismiss itself 41 | @protocol DBLoginControllerDelegate 42 | 43 | - (void)loginControllerDidLogin:(DBLoginController*)controller; 44 | - (void)loginControllerDidCancel:(DBLoginController*)controller; 45 | 46 | @end 47 | -------------------------------------------------------------------------------- /CocoParticle/DropboxSDK/DBMetadata.h: -------------------------------------------------------------------------------- 1 | // 2 | // DBMetadata.h 3 | // DropboxSDK 4 | // 5 | // Created by Brian Smith on 5/3/10. 6 | // Copyright 2010 Dropbox, Inc. All rights reserved. 7 | // 8 | 9 | 10 | @interface DBMetadata : NSObject { 11 | BOOL thumbnailExists; 12 | long long totalBytes; 13 | NSDate* lastModifiedDate; 14 | NSString* path; 15 | BOOL isDirectory; 16 | NSArray* contents; 17 | NSString* hash; 18 | NSString* humanReadableSize; 19 | NSString* root; 20 | NSString* icon; 21 | long long revision; 22 | BOOL isDeleted; 23 | } 24 | 25 | - (id)initWithDictionary:(NSDictionary*)dict; 26 | 27 | @property (nonatomic, readonly) BOOL thumbnailExists; 28 | @property (nonatomic, readonly) long long totalBytes; 29 | @property (nonatomic, readonly) NSDate* lastModifiedDate; 30 | @property (nonatomic, readonly) NSString* path; 31 | @property (nonatomic, readonly) BOOL isDirectory; 32 | @property (nonatomic, readonly) NSArray* contents; 33 | @property (nonatomic, readonly) NSString* hash; 34 | @property (nonatomic, readonly) NSString* humanReadableSize; 35 | @property (nonatomic, readonly) NSString* root; 36 | @property (nonatomic, readonly) NSString* icon; 37 | @property (nonatomic, readonly) long long revision; 38 | @property (nonatomic, readonly) BOOL isDeleted; 39 | 40 | @end 41 | -------------------------------------------------------------------------------- /CocoParticle/DropboxSDK/DBQuota.h: -------------------------------------------------------------------------------- 1 | // 2 | // DBQuota.h 3 | // DropboxSDK 4 | // 5 | // Created by Brian Smith on 5/3/10. 6 | // Copyright 2010 Dropbox, Inc. All rights reserved. 7 | // 8 | 9 | 10 | @interface DBQuota : NSObject { 11 | long long normalConsumedBytes; 12 | long long sharedConsumedBytes; 13 | long long totalBytes; 14 | } 15 | 16 | - (id)initWithDictionary:(NSDictionary*)dict; 17 | 18 | @property (nonatomic, readonly) long long normalConsumedBytes; 19 | @property (nonatomic, readonly) long long sharedConsumedBytes; 20 | @property (nonatomic, readonly) long long totalConsumedBytes; 21 | @property (nonatomic, readonly) long long totalBytes; 22 | 23 | @end 24 | -------------------------------------------------------------------------------- /CocoParticle/DropboxSDK/DBQuota.m: -------------------------------------------------------------------------------- 1 | // 2 | // DBQuotaInfo.m 3 | // DropboxSDK 4 | // 5 | // Created by Brian Smith on 5/3/10. 6 | // Copyright 2010 Dropbox, Inc. All rights reserved. 7 | // 8 | 9 | #import "DBQuota.h" 10 | 11 | 12 | @implementation DBQuota 13 | 14 | - (id)initWithDictionary:(NSDictionary*)dict { 15 | if ((self = [super init])) { 16 | normalConsumedBytes = [[dict objectForKey:@"normal"] longLongValue]; 17 | sharedConsumedBytes = [[dict objectForKey:@"shared"] longLongValue]; 18 | totalBytes = [[dict objectForKey:@"quota"] longLongValue]; 19 | } 20 | return self; 21 | } 22 | 23 | - (void)dealloc { 24 | [super dealloc]; 25 | } 26 | 27 | @synthesize normalConsumedBytes; 28 | @synthesize sharedConsumedBytes; 29 | @synthesize totalBytes; 30 | 31 | - (long long)totalConsumedBytes { 32 | return normalConsumedBytes + sharedConsumedBytes; 33 | } 34 | 35 | 36 | #pragma mark NSCoding methods 37 | 38 | - (void)encodeWithCoder:(NSCoder*)coder { 39 | [coder encodeInt64:normalConsumedBytes forKey:@"normalConsumedBytes"]; 40 | [coder encodeInt64:sharedConsumedBytes forKey:@"sharedConsumedBytes"]; 41 | [coder encodeInt64:totalBytes forKey:@"totalBytes"]; 42 | } 43 | 44 | - (id)initWithCoder:(NSCoder*)coder { 45 | self = [super init]; 46 | normalConsumedBytes = [coder decodeInt64ForKey:@"normalConsumedBytes"]; 47 | sharedConsumedBytes = [coder decodeInt64ForKey:@"sharedConsumedBytes"]; 48 | totalBytes = [coder decodeInt64ForKey:@"totalBytes"]; 49 | return self; 50 | } 51 | 52 | @end 53 | -------------------------------------------------------------------------------- /CocoParticle/DropboxSDK/DBRequest.h: -------------------------------------------------------------------------------- 1 | // 2 | // DBRestRequest.h 3 | // DropboxSDK 4 | // 5 | // Created by Brian Smith on 4/9/10. 6 | // Copyright 2010 Dropbox, Inc. All rights reserved. 7 | // 8 | 9 | 10 | @protocol DBNetworkRequestDelegate; 11 | 12 | /* DBRestRequest will download a URL either into a file that you provied the name to or it will 13 | create an NSData object with the result. When it has completed downloading the URL, it will 14 | notify the target with a selector that takes the DBRestRequest as the only parameter. */ 15 | @interface DBRequest : NSObject { 16 | NSURLRequest* request; 17 | id target; 18 | SEL selector; 19 | NSURLConnection* urlConnection; 20 | NSFileHandle* fileHandle; 21 | 22 | SEL failureSelector; 23 | SEL downloadProgressSelector; 24 | SEL uploadProgressSelector; 25 | NSString* resultFilename; 26 | NSString* tempFilename; 27 | NSDictionary* userInfo; 28 | 29 | NSHTTPURLResponse* response; 30 | NSInteger bytesDownloaded; 31 | CGFloat downloadProgress; 32 | CGFloat uploadProgress; 33 | NSMutableData* resultData; 34 | NSError* error; 35 | } 36 | 37 | /* Set this to get called when _any_ request starts or stops. This should hook into whatever 38 | network activity indicator system you have. */ 39 | + (void)setNetworkRequestDelegate:(id)delegate; 40 | 41 | /* This constructor downloads the URL into the resultData object */ 42 | - (id)initWithURLRequest:(NSURLRequest*)request andInformTarget:(id)target selector:(SEL)selector; 43 | 44 | /* Cancels the request and prevents it from sending additional messages to the delegate. */ 45 | - (void)cancel; 46 | 47 | @property (nonatomic, assign) SEL failureSelector; // To send failure events to a different selector set this 48 | @property (nonatomic, assign) SEL downloadProgressSelector; // To receive download progress events set this 49 | @property (nonatomic, assign) SEL uploadProgressSelector; // To receive upload progress events set this 50 | @property (nonatomic, retain) NSString* resultFilename; // The file to put the HTTP body in, otherwise body is stored in resultData 51 | @property (nonatomic, retain) NSDictionary* userInfo; 52 | 53 | @property (nonatomic, readonly) NSURLRequest* request; 54 | @property (nonatomic, readonly) NSHTTPURLResponse* response; 55 | @property (nonatomic, readonly) NSInteger statusCode; 56 | @property (nonatomic, readonly) CGFloat downloadProgress; 57 | @property (nonatomic, readonly) CGFloat uploadProgress; 58 | @property (nonatomic, readonly) NSData* resultData; 59 | @property (nonatomic, readonly) NSString* resultString; 60 | @property (nonatomic, readonly) NSObject* resultJSON; 61 | @property (nonatomic, readonly) NSError* error; 62 | 63 | @end 64 | 65 | 66 | @protocol DBNetworkRequestDelegate 67 | 68 | - (void)networkRequestStarted; 69 | - (void)networkRequestStopped; 70 | 71 | @end 72 | -------------------------------------------------------------------------------- /CocoParticle/DropboxSDK/DBSession.h: -------------------------------------------------------------------------------- 1 | // 2 | // DBSession.h 3 | // DropboxSDK 4 | // 5 | // Created by Brian Smith on 4/8/10. 6 | // Copyright 2010 Dropbox, Inc. All rights reserved. 7 | // 8 | 9 | #import "MPOAuthCredentialConcreteStore.h" 10 | 11 | extern NSString* kDBDropboxAPIHost; 12 | extern NSString* kDBDropboxAPIContentHost; 13 | extern NSString* kDBDropboxAPIVersion; 14 | 15 | @protocol DBSessionDelegate; 16 | 17 | 18 | /* Creating and setting the shared DBSession should be done before any other Dropbox objects are 19 | used, perferrably in the UIApplication delegate. */ 20 | @interface DBSession : NSObject { 21 | MPOAuthCredentialConcreteStore* credentialStore; 22 | id delegate; 23 | } 24 | 25 | + (DBSession*)sharedSession; 26 | + (void)setSharedSession:(DBSession*)session; 27 | 28 | - (id)initWithConsumerKey:(NSString*)key consumerSecret:(NSString*)secret; 29 | - (BOOL)isLinked; // If not linked, you can only call loginWithEmail:password from the DBRestClient 30 | 31 | - (void)updateAccessToken:(NSString*)token accessTokenSecret:(NSString*)secret; 32 | - (void)unlink; 33 | 34 | @property (nonatomic, readonly) MPOAuthCredentialConcreteStore* credentialStore; 35 | @property (nonatomic, assign) id delegate; 36 | 37 | @end 38 | 39 | 40 | @protocol DBSessionDelegate 41 | 42 | - (void)sessionDidReceiveAuthorizationFailure:(DBSession*)session; 43 | 44 | @end 45 | -------------------------------------------------------------------------------- /CocoParticle/DropboxSDK/DropboxSDK.h: -------------------------------------------------------------------------------- 1 | /* 2 | * DropboxSDK.h 3 | * DropboxSDK 4 | * 5 | * Created by Brian Smith on 7/13/10. 6 | * Copyright 2010 Dropbox, Inc. All rights reserved. 7 | * 8 | */ 9 | 10 | /* Import this file to get the most important header files imported */ 11 | #import "DBSession.h" 12 | #import "DBRestClient.h" 13 | #import "DBLoginController.h" 14 | #import "DBAccountInfo.h" 15 | #import "DBMetadata.h" 16 | #import "DBQuota.h" 17 | #import "DBError.h" -------------------------------------------------------------------------------- /CocoParticle/DropboxSDK/JSON/JSON.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2009 Stig Brautaset. All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | 7 | * Redistributions of source code must retain the above copyright notice, this 8 | list of conditions and the following disclaimer. 9 | 10 | * Redistributions in binary form must reproduce the above copyright notice, 11 | this list of conditions and the following disclaimer in the documentation 12 | and/or other materials provided with the distribution. 13 | 14 | * Neither the name of the author nor the names of its contributors may be used 15 | to endorse or promote products derived from this software without specific 16 | prior written permission. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 21 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE 22 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 24 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 25 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 26 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | */ 29 | 30 | /** 31 | @mainpage A strict JSON parser and generator for Objective-C 32 | 33 | JSON (JavaScript Object Notation) is a lightweight data-interchange 34 | format. This framework provides two apis for parsing and generating 35 | JSON. One standard object-based and a higher level api consisting of 36 | categories added to existing Objective-C classes. 37 | 38 | Learn more on the http://code.google.com/p/json-framework project site. 39 | 40 | This framework does its best to be as strict as possible, both in what it 41 | accepts and what it generates. For example, it does not support trailing commas 42 | in arrays or objects. Nor does it support embedded comments, or 43 | anything else not in the JSON specification. This is considered a feature. 44 | 45 | */ 46 | 47 | #import "SBJSON.h" 48 | #import "NSObject+SBJSON.h" 49 | #import "NSString+SBJSON.h" 50 | 51 | -------------------------------------------------------------------------------- /CocoParticle/DropboxSDK/JSON/NSObject+SBJSON.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2009 Stig Brautaset. All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | 7 | * Redistributions of source code must retain the above copyright notice, this 8 | list of conditions and the following disclaimer. 9 | 10 | * Redistributions in binary form must reproduce the above copyright notice, 11 | this list of conditions and the following disclaimer in the documentation 12 | and/or other materials provided with the distribution. 13 | 14 | * Neither the name of the author nor the names of its contributors may be used 15 | to endorse or promote products derived from this software without specific 16 | prior written permission. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 21 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE 22 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 24 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 25 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 26 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | */ 29 | 30 | #import 31 | 32 | 33 | /** 34 | @brief Adds JSON generation to Foundation classes 35 | 36 | This is a category on NSObject that adds methods for returning JSON representations 37 | of standard objects to the objects themselves. This means you can call the 38 | -JSONRepresentation method on an NSArray object and it'll do what you want. 39 | */ 40 | @interface NSObject (NSObject_SBJSON) 41 | 42 | /** 43 | @brief Returns a string containing the receiver encoded as a JSON fragment. 44 | 45 | This method is added as a category on NSObject but is only actually 46 | supported for the following objects: 47 | @li NSDictionary 48 | @li NSArray 49 | @li NSString 50 | @li NSNumber (also used for booleans) 51 | @li NSNull 52 | 53 | @deprecated Given we bill ourselves as a "strict" JSON library, this method should be removed. 54 | */ 55 | - (NSString *)JSONFragment; 56 | 57 | /** 58 | @brief Returns a string containing the receiver encoded in JSON. 59 | 60 | This method is added as a category on NSObject but is only actually 61 | supported for the following objects: 62 | @li NSDictionary 63 | @li NSArray 64 | */ 65 | - (NSString *)JSONRepresentation; 66 | 67 | @end 68 | 69 | -------------------------------------------------------------------------------- /CocoParticle/DropboxSDK/JSON/NSObject+SBJSON.m: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2009 Stig Brautaset. All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | 7 | * Redistributions of source code must retain the above copyright notice, this 8 | list of conditions and the following disclaimer. 9 | 10 | * Redistributions in binary form must reproduce the above copyright notice, 11 | this list of conditions and the following disclaimer in the documentation 12 | and/or other materials provided with the distribution. 13 | 14 | * Neither the name of the author nor the names of its contributors may be used 15 | to endorse or promote products derived from this software without specific 16 | prior written permission. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 21 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE 22 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 24 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 25 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 26 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | */ 29 | 30 | #import "NSObject+SBJSON.h" 31 | #import "SBJsonWriter.h" 32 | 33 | @implementation NSObject (NSObject_SBJSON) 34 | 35 | - (NSString *)JSONFragment { 36 | SBJsonWriter *jsonWriter = [SBJsonWriter new]; 37 | NSString *json = [jsonWriter stringWithFragment:self]; 38 | if (!json) 39 | NSLog(@"-JSONFragment failed. Error trace is: %@", [jsonWriter errorTrace]); 40 | [jsonWriter release]; 41 | return json; 42 | } 43 | 44 | - (NSString *)JSONRepresentation { 45 | SBJsonWriter *jsonWriter = [SBJsonWriter new]; 46 | NSString *json = [jsonWriter stringWithObject:self]; 47 | if (!json) 48 | NSLog(@"-JSONRepresentation failed. Error trace is: %@", [jsonWriter errorTrace]); 49 | [jsonWriter release]; 50 | return json; 51 | } 52 | 53 | @end 54 | -------------------------------------------------------------------------------- /CocoParticle/DropboxSDK/JSON/NSString+SBJSON.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2009 Stig Brautaset. All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | 7 | * Redistributions of source code must retain the above copyright notice, this 8 | list of conditions and the following disclaimer. 9 | 10 | * Redistributions in binary form must reproduce the above copyright notice, 11 | this list of conditions and the following disclaimer in the documentation 12 | and/or other materials provided with the distribution. 13 | 14 | * Neither the name of the author nor the names of its contributors may be used 15 | to endorse or promote products derived from this software without specific 16 | prior written permission. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 21 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE 22 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 24 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 25 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 26 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | */ 29 | 30 | #import 31 | 32 | /** 33 | @brief Adds JSON parsing methods to NSString 34 | 35 | This is a category on NSString that adds methods for parsing the target string. 36 | */ 37 | @interface NSString (NSString_SBJSON) 38 | 39 | 40 | /** 41 | @brief Returns the object represented in the receiver, or nil on error. 42 | 43 | Returns a a scalar object represented by the string's JSON fragment representation. 44 | 45 | @deprecated Given we bill ourselves as a "strict" JSON library, this method should be removed. 46 | */ 47 | - (id)JSONFragmentValue; 48 | 49 | /** 50 | @brief Returns the NSDictionary or NSArray represented by the current string's JSON representation. 51 | 52 | Returns the dictionary or array represented in the receiver, or nil on error. 53 | 54 | Returns the NSDictionary or NSArray represented by the current string's JSON representation. 55 | */ 56 | - (id)JSONValue; 57 | 58 | @end 59 | -------------------------------------------------------------------------------- /CocoParticle/DropboxSDK/JSON/NSString+SBJSON.m: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2007-2009 Stig Brautaset. All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | 7 | * Redistributions of source code must retain the above copyright notice, this 8 | list of conditions and the following disclaimer. 9 | 10 | * Redistributions in binary form must reproduce the above copyright notice, 11 | this list of conditions and the following disclaimer in the documentation 12 | and/or other materials provided with the distribution. 13 | 14 | * Neither the name of the author nor the names of its contributors may be used 15 | to endorse or promote products derived from this software without specific 16 | prior written permission. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 21 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE 22 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 24 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 25 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 26 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | */ 29 | 30 | #import "NSString+SBJSON.h" 31 | #import "SBJsonParser.h" 32 | 33 | @implementation NSString (NSString_SBJSON) 34 | 35 | - (id)JSONFragmentValue 36 | { 37 | SBJsonParser *jsonParser = [SBJsonParser new]; 38 | id repr = [jsonParser fragmentWithString:self]; 39 | if (!repr) 40 | NSLog(@"-JSONFragmentValue failed. Error trace is: %@", [jsonParser errorTrace]); 41 | [jsonParser release]; 42 | return repr; 43 | } 44 | 45 | - (id)JSONValue 46 | { 47 | SBJsonParser *jsonParser = [SBJsonParser new]; 48 | id repr = [jsonParser objectWithString:self]; 49 | if (!repr) 50 | NSLog(@"-JSONValue failed. Error trace is: %@", [jsonParser errorTrace]); 51 | [jsonParser release]; 52 | return repr; 53 | } 54 | 55 | @end 56 | -------------------------------------------------------------------------------- /CocoParticle/DropboxSDK/JSON/SBJSON.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2007-2009 Stig Brautaset. All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | 7 | * Redistributions of source code must retain the above copyright notice, this 8 | list of conditions and the following disclaimer. 9 | 10 | * Redistributions in binary form must reproduce the above copyright notice, 11 | this list of conditions and the following disclaimer in the documentation 12 | and/or other materials provided with the distribution. 13 | 14 | * Neither the name of the author nor the names of its contributors may be used 15 | to endorse or promote products derived from this software without specific 16 | prior written permission. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 21 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE 22 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 24 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 25 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 26 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | */ 29 | 30 | #import 31 | #import "SBJsonParser.h" 32 | #import "SBJsonWriter.h" 33 | 34 | /** 35 | @brief Facade for SBJsonWriter/SBJsonParser. 36 | 37 | Requests are forwarded to instances of SBJsonWriter and SBJsonParser. 38 | */ 39 | @interface SBJSON : SBJsonBase { 40 | 41 | @private 42 | SBJsonParser *jsonParser; 43 | SBJsonWriter *jsonWriter; 44 | } 45 | 46 | 47 | /// Return the fragment represented by the given string 48 | - (id)fragmentWithString:(NSString*)jsonrep 49 | error:(NSError**)error; 50 | 51 | /// Return the object represented by the given string 52 | - (id)objectWithString:(NSString*)jsonrep 53 | error:(NSError**)error; 54 | 55 | /// Parse the string and return the represented object (or scalar) 56 | - (id)objectWithString:(id)value 57 | allowScalar:(BOOL)x 58 | error:(NSError**)error; 59 | 60 | 61 | /// Return JSON representation of an array or dictionary 62 | - (NSString*)stringWithObject:(id)value 63 | error:(NSError**)error; 64 | 65 | /// Return JSON representation of any legal JSON value 66 | - (NSString*)stringWithFragment:(id)value 67 | error:(NSError**)error; 68 | 69 | /// Return JSON representation (or fragment) for the given object 70 | - (NSString*)stringWithObject:(id)value 71 | allowScalar:(BOOL)x 72 | error:(NSError**)error; 73 | 74 | 75 | @end 76 | -------------------------------------------------------------------------------- /CocoParticle/DropboxSDK/JSON/SBJsonBase.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2009 Stig Brautaset. All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | 7 | * Redistributions of source code must retain the above copyright notice, this 8 | list of conditions and the following disclaimer. 9 | 10 | * Redistributions in binary form must reproduce the above copyright notice, 11 | this list of conditions and the following disclaimer in the documentation 12 | and/or other materials provided with the distribution. 13 | 14 | * Neither the name of the author nor the names of its contributors may be used 15 | to endorse or promote products derived from this software without specific 16 | prior written permission. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 21 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE 22 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 24 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 25 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 26 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | */ 29 | 30 | #import 31 | 32 | extern NSString * SBJSONErrorDomain; 33 | 34 | 35 | enum { 36 | EUNSUPPORTED = 1, 37 | EPARSENUM, 38 | EPARSE, 39 | EFRAGMENT, 40 | ECTRL, 41 | EUNICODE, 42 | EDEPTH, 43 | EESCAPE, 44 | ETRAILCOMMA, 45 | ETRAILGARBAGE, 46 | EEOF, 47 | EINPUT 48 | }; 49 | 50 | /** 51 | @brief Common base class for parsing & writing. 52 | 53 | This class contains the common error-handling code and option between the parser/writer. 54 | */ 55 | @interface SBJsonBase : NSObject { 56 | NSMutableArray *errorTrace; 57 | 58 | @protected 59 | NSUInteger depth, maxDepth; 60 | } 61 | 62 | /** 63 | @brief The maximum recursing depth. 64 | 65 | Defaults to 512. If the input is nested deeper than this the input will be deemed to be 66 | malicious and the parser returns nil, signalling an error. ("Nested too deep".) You can 67 | turn off this security feature by setting the maxDepth value to 0. 68 | */ 69 | @property NSUInteger maxDepth; 70 | 71 | /** 72 | @brief Return an error trace, or nil if there was no errors. 73 | 74 | Note that this method returns the trace of the last method that failed. 75 | You need to check the return value of the call you're making to figure out 76 | if the call actually failed, before you know call this method. 77 | */ 78 | @property(copy,readonly) NSArray* errorTrace; 79 | 80 | /// @internal for use in subclasses to add errors to the stack trace 81 | - (void)addErrorWithCode:(NSUInteger)code description:(NSString*)str; 82 | 83 | /// @internal for use in subclasess to clear the error before a new parsing attempt 84 | - (void)clearErrorTrace; 85 | 86 | @end 87 | -------------------------------------------------------------------------------- /CocoParticle/DropboxSDK/JSON/SBJsonBase.m: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2009 Stig Brautaset. All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | 7 | * Redistributions of source code must retain the above copyright notice, this 8 | list of conditions and the following disclaimer. 9 | 10 | * Redistributions in binary form must reproduce the above copyright notice, 11 | this list of conditions and the following disclaimer in the documentation 12 | and/or other materials provided with the distribution. 13 | 14 | * Neither the name of the author nor the names of its contributors may be used 15 | to endorse or promote products derived from this software without specific 16 | prior written permission. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 21 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE 22 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 24 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 25 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 26 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | */ 29 | 30 | #import "SBJsonBase.h" 31 | NSString * SBJSONErrorDomain = @"org.brautaset.JSON.ErrorDomain"; 32 | 33 | 34 | @implementation SBJsonBase 35 | 36 | @synthesize errorTrace; 37 | @synthesize maxDepth; 38 | 39 | - (id)init { 40 | self = [super init]; 41 | if (self) 42 | self.maxDepth = 512; 43 | return self; 44 | } 45 | 46 | - (void)dealloc { 47 | [errorTrace release]; 48 | [super dealloc]; 49 | } 50 | 51 | - (void)addErrorWithCode:(NSUInteger)code description:(NSString*)str { 52 | NSDictionary *userInfo; 53 | if (!errorTrace) { 54 | errorTrace = [NSMutableArray new]; 55 | userInfo = [NSDictionary dictionaryWithObject:str forKey:NSLocalizedDescriptionKey]; 56 | 57 | } else { 58 | userInfo = [NSDictionary dictionaryWithObjectsAndKeys: 59 | str, NSLocalizedDescriptionKey, 60 | [errorTrace lastObject], NSUnderlyingErrorKey, 61 | nil]; 62 | } 63 | 64 | NSError *error = [NSError errorWithDomain:SBJSONErrorDomain code:code userInfo:userInfo]; 65 | 66 | [self willChangeValueForKey:@"errorTrace"]; 67 | [errorTrace addObject:error]; 68 | [self didChangeValueForKey:@"errorTrace"]; 69 | } 70 | 71 | - (void)clearErrorTrace { 72 | [self willChangeValueForKey:@"errorTrace"]; 73 | [errorTrace release]; 74 | errorTrace = nil; 75 | [self didChangeValueForKey:@"errorTrace"]; 76 | } 77 | 78 | @end 79 | -------------------------------------------------------------------------------- /CocoParticle/DropboxSDK/MPOAuth/Crypto/Base64Transcoder.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Base64Transcoder.h 3 | * Base64Test 4 | * 5 | * Created by Jonathan Wight on Tue Mar 18 2003. 6 | * Copyright (c) 2003 Toxic Software. All rights reserved. 7 | * 8 | * Permission is hereby granted, free of charge, to any person obtaining a copy 9 | * of this software and associated documentation files (the "Software"), to deal 10 | * in the Software without restriction, including without limitation the rights 11 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | * copies of the Software, and to permit persons to whom the Software is 13 | * furnished to do so, subject to the following conditions: 14 | * 15 | * The above copyright notice and this permission notice shall be included in 16 | * all copies or substantial portions of the Software. 17 | * 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | * THE SOFTWARE. 25 | * 26 | */ 27 | 28 | #include 29 | #include 30 | 31 | extern size_t EstimateBas64EncodedDataSize(size_t inDataSize); 32 | extern size_t EstimateBas64DecodedDataSize(size_t inDataSize); 33 | 34 | extern bool Base64EncodeData(const void *inInputData, size_t inInputDataSize, char *outOutputData, size_t *ioOutputDataSize); 35 | extern bool Base64DecodeData(const void *inInputData, size_t inInputDataSize, void *ioOutputData, size_t *ioOutputDataSize); 36 | 37 | -------------------------------------------------------------------------------- /CocoParticle/DropboxSDK/MPOAuth/MPDebug.h: -------------------------------------------------------------------------------- 1 | // 2 | // MPDebug.h 3 | // MPOAuthConnection 4 | // 5 | // Created by Karl Adam on 09.02.06. 6 | // Copyright 2009 matrixPointer. All rights reserved. 7 | // 8 | 9 | #ifdef DEBUG 10 | #define MPLog(...) NSLog(__VA_ARGS__) 11 | #else 12 | #define MPLog(...) do { } while (0) 13 | #endif 14 | -------------------------------------------------------------------------------- /CocoParticle/DropboxSDK/MPOAuth/MPOAuth.h: -------------------------------------------------------------------------------- 1 | // 2 | // MPOAuth.h 3 | // MPOAuthConnection 4 | // 5 | // Created by Karl Adam on 08.12.13. 6 | // Copyright 2008 matrixPointer. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | 12 | #import 13 | #import 14 | #import 15 | #import 16 | #import 17 | #import 18 | #import 19 | #import 20 | #import 21 | -------------------------------------------------------------------------------- /CocoParticle/DropboxSDK/MPOAuth/MPOAuthAPIRequestLoader.h: -------------------------------------------------------------------------------- 1 | // 2 | // MPOAuthAPIRequestLoader.h 3 | // MPOAuthConnection 4 | // 5 | // Created by Karl Adam on 08.12.05. 6 | // Copyright 2008 matrixPointer. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | extern NSString * const MPOAuthNotificationRequestTokenReceived; 12 | extern NSString * const MPOAuthNotificationRequestTokenRejected; 13 | extern NSString * const MPOAuthNotificationAccessTokenReceived; 14 | extern NSString * const MPOAuthNotificationAccessTokenRejected; 15 | extern NSString * const MPOAuthNotificationAccessTokenRefreshed; 16 | extern NSString * const MPOAuthNotificationErrorHasOccurred; 17 | 18 | @protocol MPOAuthCredentialStore; 19 | @protocol MPOAuthParameterFactory; 20 | 21 | @class MPOAuthURLRequest; 22 | @class MPOAuthURLResponse; 23 | @class MPOAuthCredentialConcreteStore; 24 | 25 | @interface MPOAuthAPIRequestLoader : NSObject { 26 | MPOAuthCredentialConcreteStore *_credentials; 27 | MPOAuthURLRequest *_oauthRequest; 28 | MPOAuthURLResponse *_oauthResponse; 29 | NSMutableData *_dataBuffer; 30 | NSString *_dataAsString; 31 | NSError *_error; 32 | id _target; 33 | SEL _action; 34 | } 35 | 36 | @property (nonatomic, readwrite, retain) id credentials; 37 | @property (nonatomic, readwrite, retain) MPOAuthURLRequest *oauthRequest; 38 | @property (nonatomic, readwrite, retain) MPOAuthURLResponse *oauthResponse; 39 | @property (nonatomic, readonly, retain) NSData *data; 40 | @property (nonatomic, readonly, retain) NSString *responseString; 41 | @property (nonatomic, readwrite, assign) id target; 42 | @property (nonatomic, readwrite, assign) SEL action; 43 | 44 | - (id)initWithURL:(NSURL *)inURL; 45 | - (id)initWithRequest:(MPOAuthURLRequest *)inRequest; 46 | 47 | - (void)loadSynchronously:(BOOL)inSynchronous; 48 | 49 | @end 50 | 51 | -------------------------------------------------------------------------------- /CocoParticle/DropboxSDK/MPOAuth/MPOAuthAuthenticationMethod.h: -------------------------------------------------------------------------------- 1 | // 2 | // MPOAuthAuthenticationMethod.h 3 | // MPOAuthConnection 4 | // 5 | // Created by Karl Adam on 09.12.19. 6 | // Copyright 2009 matrixPointer. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | extern NSString * const MPOAuthAccessTokenURLKey; 12 | 13 | @class MPOAuthAPI; 14 | 15 | @interface MPOAuthAuthenticationMethod : NSObject { 16 | MPOAuthAPI *oauthAPI_; 17 | NSURL *oauthGetAccessTokenURL_; 18 | NSTimer *refreshTimer_; 19 | } 20 | 21 | @property (nonatomic, readwrite, assign) MPOAuthAPI *oauthAPI; 22 | @property (nonatomic, readwrite, retain) NSURL *oauthGetAccessTokenURL; 23 | 24 | - (id)initWithAPI:(MPOAuthAPI *)inAPI forURL:(NSURL *)inURL; 25 | - (id)initWithAPI:(MPOAuthAPI *)inAPI forURL:(NSURL *)inURL withConfiguration:(NSDictionary *)inConfig; 26 | - (void)authenticate; 27 | 28 | - (void)setTokenRefreshInterval:(NSTimeInterval)inTimeInterval; 29 | - (void)refreshAccessToken; 30 | @end 31 | -------------------------------------------------------------------------------- /CocoParticle/DropboxSDK/MPOAuth/MPOAuthAuthenticationMethodOAuth.h: -------------------------------------------------------------------------------- 1 | // 2 | // MPOAuthAuthenticationMethodOAuth.h 3 | // MPOAuthConnection 4 | // 5 | // Created by Karl Adam on 09.12.19. 6 | // Copyright 2009 matrixPointer. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "MPOAuthAuthenticationMethod.h" 11 | #import "MPOAuthAPI.h" 12 | #import "MPOAuthAPIRequestLoader.h" 13 | 14 | extern NSString * const MPOAuthNotificationRequestTokenReceived; 15 | extern NSString * const MPOAuthNotificationRequestTokenRejected; 16 | 17 | @protocol MPOAuthAuthenticationMethodOAuthDelegate; 18 | 19 | @interface MPOAuthAuthenticationMethodOAuth : MPOAuthAuthenticationMethod { 20 | NSURL *oauthRequestTokenURL_; 21 | NSURL *oauthAuthorizeTokenURL_; 22 | BOOL oauth10aModeActive_; 23 | 24 | id delegate_; 25 | } 26 | 27 | @property (nonatomic, readwrite, assign) id delegate; 28 | 29 | @property (nonatomic, readwrite, retain) NSURL *oauthRequestTokenURL; 30 | @property (nonatomic, readwrite, retain) NSURL *oauthAuthorizeTokenURL; 31 | 32 | - (void)authenticate; 33 | 34 | @end 35 | 36 | @protocol MPOAuthAuthenticationMethodOAuthDelegate 37 | - (NSURL *)callbackURLForCompletedUserAuthorization; 38 | - (BOOL)automaticallyRequestAuthenticationFromURL:(NSURL *)inAuthURL withCallbackURL:(NSURL *)inCallbackURL; 39 | 40 | @optional 41 | - (NSString *)oauthVerifierForCompletedUserAuthorization; 42 | - (void)authenticationDidFailWithError:(NSError *)error; 43 | @end 44 | 45 | -------------------------------------------------------------------------------- /CocoParticle/DropboxSDK/MPOAuth/MPOAuthConnection.h: -------------------------------------------------------------------------------- 1 | // 2 | // MPOAuthConnection.h 3 | // MPOAuthConnection 4 | // 5 | // Created by Karl Adam on 08.12.05. 6 | // Copyright 2008 matrixPointer. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @protocol MPOAuthCredentialStore; 12 | @protocol MPOAuthParameterFactory; 13 | 14 | @class MPOAuthURLRequest; 15 | @class MPOAuthURLResponse; 16 | @class MPOAuthCredentialConcreteStore; 17 | 18 | @interface MPOAuthConnection : NSURLConnection { 19 | @private 20 | MPOAuthCredentialConcreteStore *_credentials; 21 | } 22 | 23 | @property (nonatomic, readonly) id credentials; 24 | 25 | + (MPOAuthConnection *)connectionWithRequest:(MPOAuthURLRequest *)inRequest delegate:(id)inDelegate credentials:(NSObject *)inCredentials; 26 | + (NSData *)sendSynchronousRequest:(MPOAuthURLRequest *)inRequest usingCredentials:(NSObject *)inCredentials returningResponse:(MPOAuthURLResponse **)outResponse error:(NSError **)inError; 27 | - (id)initWithRequest:(MPOAuthURLRequest *)inRequest delegate:(id)inDelegate credentials:(NSObject *)inCredentials; 28 | 29 | @end 30 | -------------------------------------------------------------------------------- /CocoParticle/DropboxSDK/MPOAuth/MPOAuthConnection.m: -------------------------------------------------------------------------------- 1 | // 2 | // MPOAuthConnection.m 3 | // MPOAuthConnection 4 | // 5 | // Created by Karl Adam on 08.12.05. 6 | // Copyright 2008 matrixPointer. All rights reserved. 7 | // 8 | 9 | #import "MPOAuthConnection.h" 10 | #import "MPOAuthURLRequest.h" 11 | #import "MPOAuthURLResponse.h" 12 | #import "MPOAuthParameterFactory.h" 13 | #import "MPOAuthCredentialConcreteStore.h" 14 | 15 | @interface MPOAuthURLResponse () 16 | @property (nonatomic, readwrite, retain) NSURLResponse *urlResponse; 17 | @property (nonatomic, readwrite, retain) NSDictionary *oauthParameters; 18 | @end 19 | 20 | @implementation MPOAuthConnection 21 | 22 | + (MPOAuthConnection *)connectionWithRequest:(MPOAuthURLRequest *)inRequest delegate:(id)inDelegate credentials:(NSObject *)inCredentials { 23 | MPOAuthConnection *aConnection = [[MPOAuthConnection alloc] initWithRequest:inRequest delegate:inDelegate credentials:inCredentials]; 24 | return [aConnection autorelease]; 25 | } 26 | 27 | + (NSData *)sendSynchronousRequest:(MPOAuthURLRequest *)inRequest usingCredentials:(NSObject *)inCredentials returningResponse:(MPOAuthURLResponse **)outResponse error:(NSError **)inError { 28 | [inRequest addParameters:[inCredentials oauthParameters]]; 29 | NSURLRequest *urlRequest = [inRequest urlRequestSignedWithSecret:[inCredentials signingKey] usingMethod:[inCredentials signatureMethod]]; 30 | NSURLResponse *urlResponse = nil; 31 | NSData *responseData = [self sendSynchronousRequest:urlRequest returningResponse:&urlResponse error:inError]; 32 | MPOAuthURLResponse *oauthResponse = [[[MPOAuthURLResponse alloc] init] autorelease]; 33 | oauthResponse.urlResponse = urlResponse; 34 | *outResponse = oauthResponse; 35 | 36 | return responseData; 37 | } 38 | 39 | - (id)initWithRequest:(MPOAuthURLRequest *)inRequest delegate:(id)inDelegate credentials:(NSObject *)inCredentials { 40 | [inRequest addParameters:[inCredentials oauthParameters]]; 41 | NSURLRequest *urlRequest = [inRequest urlRequestSignedWithSecret:[inCredentials signingKey] usingMethod:[inCredentials signatureMethod]]; 42 | if (self = [super initWithRequest:urlRequest delegate:inDelegate]) { 43 | _credentials = [inCredentials retain]; 44 | } 45 | return self; 46 | } 47 | 48 | - (oneway void)dealloc { 49 | [_credentials release]; 50 | 51 | [super dealloc]; 52 | } 53 | 54 | @synthesize credentials = _credentials; 55 | 56 | #pragma mark - 57 | 58 | @end 59 | -------------------------------------------------------------------------------- /CocoParticle/DropboxSDK/MPOAuth/MPOAuthCredentialConcreteStore+KeychainAdditions.h: -------------------------------------------------------------------------------- 1 | // 2 | // MPOAuthCredentialConcreteStore+TokenAdditionsMac.h 3 | // MPOAuthConnection 4 | // 5 | // Created by Karl Adam on 08.12.13. 6 | // Copyright 2008 matrixPointer. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "MPOAuthCredentialConcreteStore.h" 11 | 12 | @interface MPOAuthCredentialConcreteStore (KeychainAdditions) 13 | 14 | - (void)addToKeychainUsingName:(NSString *)inName andValue:(NSString *)inValue; 15 | - (NSString *)findValueFromKeychainUsingName:(NSString *)inName; 16 | - (void)removeValueFromKeychainUsingName:(NSString *)inName; 17 | 18 | @end 19 | -------------------------------------------------------------------------------- /CocoParticle/DropboxSDK/MPOAuth/MPOAuthCredentialConcreteStore.h: -------------------------------------------------------------------------------- 1 | // 2 | // MPOAuthCredentialConcreteStore.h 3 | // MPOAuthConnection 4 | // 5 | // Created by Karl Adam on 08.12.11. 6 | // Copyright 2008 matrixPointer. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "MPOAuthCredentialStore.h" 11 | #import "MPOAuthParameterFactory.h" 12 | 13 | @interface MPOAuthCredentialConcreteStore : NSObject { 14 | NSMutableDictionary *store_; 15 | NSURL *baseURL_; 16 | NSURL *authenticationURL_; 17 | } 18 | 19 | @property (nonatomic, readonly, retain) NSURL *baseURL; 20 | @property (nonatomic, readonly, retain) NSURL *authenticationURL; 21 | 22 | @property (nonatomic, readonly) NSString *tokenSecret; 23 | @property (nonatomic, readonly) NSString *signingKey; 24 | 25 | @property (nonatomic, readwrite, retain) NSString *requestToken; 26 | @property (nonatomic, readwrite, retain) NSString *requestTokenSecret; 27 | @property (nonatomic, readwrite, retain) NSString *accessToken; 28 | @property (nonatomic, readwrite, retain) NSString *accessTokenSecret; 29 | 30 | @property (nonatomic, readwrite, retain) NSString *sessionHandle; 31 | 32 | - (id)initWithCredentials:(NSDictionary *)inCredential; 33 | - (id)initWithCredentials:(NSDictionary *)inCredentials forBaseURL:(NSURL *)inBaseURL; 34 | - (id)initWithCredentials:(NSDictionary *)inCredentials forBaseURL:(NSURL *)inBaseURL withAuthenticationURL:(NSURL *)inAuthenticationURL; 35 | 36 | - (void)setCredential:(id)inCredential withName:(NSString *)inName; 37 | - (void)removeCredentialNamed:(NSString *)inName; 38 | 39 | 40 | @end 41 | -------------------------------------------------------------------------------- /CocoParticle/DropboxSDK/MPOAuth/MPOAuthCredentialStore.h: -------------------------------------------------------------------------------- 1 | // 2 | // MPOAuthCredentialStore.h 3 | // MPOAuthConnection 4 | // 5 | // Created by Karl Adam on 08.12.06. 6 | // Copyright 2008 matrixPointer. All rights reserved. 7 | // 8 | 9 | extern NSString *kMPOAuthCredentialConsumerKey; 10 | extern NSString *kMPOAuthCredentialConsumerSecret; 11 | extern NSString *kMPOAuthCredentialUsername; 12 | extern NSString *kMPOAuthCredentialPassword; 13 | extern NSString *kMPOAuthCredentialRequestToken; 14 | extern NSString *kMPOAuthCredentialRequestTokenSecret; 15 | extern NSString *kMPOAuthCredentialAccessToken; 16 | extern NSString *kMPOAuthCredentialAccessTokenSecret; 17 | extern NSString *kMPOAuthCredentialSessionHandle; 18 | extern NSString *kMPOAuthCredentialRealm; 19 | 20 | @protocol MPOAuthCredentialStore 21 | 22 | @property (nonatomic, readonly) NSString *consumerKey; 23 | @property (nonatomic, readonly) NSString *consumerSecret; 24 | @property (nonatomic, readonly) NSString *username; 25 | @property (nonatomic, readonly) NSString *password; 26 | @property (nonatomic, readonly, retain) NSString *requestToken; 27 | @property (nonatomic, readonly, retain) NSString *requestTokenSecret; 28 | @property (nonatomic, readonly, retain) NSString *accessToken; 29 | @property (nonatomic, readonly, retain) NSString *accessTokenSecret; 30 | 31 | - (NSString *)credentialNamed:(NSString *)inCredentialName; 32 | - (void)discardOAuthCredentials; 33 | @end 34 | -------------------------------------------------------------------------------- /CocoParticle/DropboxSDK/MPOAuth/MPOAuthParameterFactory.h: -------------------------------------------------------------------------------- 1 | // 2 | // MPOAuthParameterFactory.h 3 | // MPOAuthConnection 4 | // 5 | // Created by Karl Adam on 08.12.06. 6 | // Copyright 2008 matrixPointer. All rights reserved. 7 | // 8 | 9 | extern NSString *kMPOAuthSignatureMethod; 10 | 11 | @class MPURLRequestParameter; 12 | 13 | @protocol MPOAuthParameterFactory 14 | 15 | @property (nonatomic, readwrite, retain) NSString *signatureMethod; 16 | @property (nonatomic, readonly) NSString *signingKey; 17 | @property (nonatomic, readonly) NSString *timestamp; 18 | 19 | - (NSArray *)oauthParameters; 20 | 21 | - (MPURLRequestParameter *)oauthConsumerKeyParameter; 22 | - (MPURLRequestParameter *)oauthTokenParameter; 23 | - (MPURLRequestParameter *)oauthSignatureMethodParameter; 24 | - (MPURLRequestParameter *)oauthTimestampParameter; 25 | - (MPURLRequestParameter *)oauthNonceParameter; 26 | - (MPURLRequestParameter *)oauthVersionParameter; 27 | 28 | @end 29 | -------------------------------------------------------------------------------- /CocoParticle/DropboxSDK/MPOAuth/MPOAuthSignatureParameter.h: -------------------------------------------------------------------------------- 1 | // 2 | // MPOAuthSignatureParameter.h 3 | // MPOAuthConnection 4 | // 5 | // Created by Karl Adam on 08.12.07. 6 | // Copyright 2008 matrixPointer. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "MPURLRequestParameter.h" 11 | 12 | #define kMPOAuthSignatureMethodPlaintext @"PLAINTEXT" 13 | #define kMPOAuthSignatureMethodHMACSHA1 @"HMAC-SHA1" 14 | #define kMPOAuthSignatureMethodRSASHA1 @"RSA-SHA1" 15 | 16 | @class MPOAuthURLRequest; 17 | 18 | @interface MPOAuthSignatureParameter : MPURLRequestParameter { 19 | 20 | } 21 | 22 | + (NSString *)signatureBaseStringUsingParameterString:(NSString *)inParameterString forRequest:(MPOAuthURLRequest *)inRequest; 23 | + (NSString *)HMAC_SHA1SignatureForText:(NSString *)inText usingSecret:(NSString *)inSecret; 24 | 25 | - (id)initWithText:(NSString *)inText andSecret:(NSString *)inSecret forRequest:(MPOAuthURLRequest *)inRequest usingMethod:(NSString *)inMethod; 26 | 27 | 28 | @end 29 | -------------------------------------------------------------------------------- /CocoParticle/DropboxSDK/MPOAuth/MPOAuthURLRequest.h: -------------------------------------------------------------------------------- 1 | // 2 | // MPOAuthURLRequest.h 3 | // MPOAuthConnection 4 | // 5 | // Created by Karl Adam on 08.12.05. 6 | // Copyright 2008 matrixPointer. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | 12 | @interface MPOAuthURLRequest : NSObject { 13 | @private 14 | NSURL *_url; 15 | NSString *_httpMethod; 16 | NSURLRequest *_urlRequest; 17 | NSMutableArray *_parameters; 18 | } 19 | 20 | @property (nonatomic, readwrite, retain) NSURL *url; 21 | @property (nonatomic, readwrite, retain) NSString *HTTPMethod; 22 | @property (nonatomic, readonly, retain) NSURLRequest *urlRequest; 23 | @property (nonatomic, readwrite, retain) NSMutableArray *parameters; 24 | 25 | - (id)initWithURL:(NSURL *)inURL andParameters:(NSArray *)parameters; 26 | - (id)initWithURLRequest:(NSURLRequest *)inRequest; 27 | 28 | - (void)addParameters:(NSArray *)inParameters; 29 | 30 | - (NSMutableURLRequest*)urlRequestSignedWithSecret:(NSString *)inSecret usingMethod:(NSString *)inScheme; 31 | 32 | @end 33 | -------------------------------------------------------------------------------- /CocoParticle/DropboxSDK/MPOAuth/MPOAuthURLResponse.h: -------------------------------------------------------------------------------- 1 | // 2 | // MPOAuthURLResponse.h 3 | // MPOAuthConnection 4 | // 5 | // Created by Karl Adam on 08.12.05. 6 | // Copyright 2008 matrixPointer. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | 12 | @interface MPOAuthURLResponse : NSObject { 13 | NSURLResponse *_urlResponse; 14 | NSDictionary *_oauthParameters; 15 | } 16 | 17 | @property (nonatomic, readonly, retain) NSURLResponse *urlResponse; 18 | @property (nonatomic, readonly, retain) NSDictionary *oauthParameters; 19 | 20 | @end 21 | -------------------------------------------------------------------------------- /CocoParticle/DropboxSDK/MPOAuth/MPOAuthURLResponse.m: -------------------------------------------------------------------------------- 1 | // 2 | // MPOAuthURLResponse.m 3 | // MPOAuthConnection 4 | // 5 | // Created by Karl Adam on 08.12.05. 6 | // Copyright 2008 matrixPointer. All rights reserved. 7 | // 8 | 9 | #import "MPOAuthURLResponse.h" 10 | 11 | @interface MPOAuthURLResponse () 12 | @property (nonatomic, readwrite, retain) NSURLResponse *urlResponse; 13 | @property (nonatomic, readwrite, retain) NSDictionary *oauthParameters; 14 | @end 15 | 16 | @implementation MPOAuthURLResponse 17 | 18 | - (id)init { 19 | if (self = [super init]) { 20 | 21 | } 22 | return self; 23 | } 24 | 25 | - (oneway void)dealloc { 26 | self.urlResponse = nil; 27 | self.oauthParameters = nil; 28 | 29 | [super dealloc]; 30 | } 31 | 32 | @synthesize urlResponse = _urlResponse; 33 | @synthesize oauthParameters = _oauthParameters; 34 | 35 | @end 36 | -------------------------------------------------------------------------------- /CocoParticle/DropboxSDK/MPOAuth/MPURLRequestParameter.h: -------------------------------------------------------------------------------- 1 | // 2 | // MPURLParameter.h 3 | // MPOAuthConnection 4 | // 5 | // Created by Karl Adam on 08.12.05. 6 | // Copyright 2008 matrixPointer. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | 12 | @interface MPURLRequestParameter : NSObject { 13 | NSString *_name; 14 | NSString *_value; 15 | } 16 | 17 | @property (nonatomic, readwrite, copy) NSString *name; 18 | @property (nonatomic, readwrite, copy) NSString *value; 19 | 20 | + (NSArray *)parametersFromString:(NSString *)inString; 21 | + (NSArray *)parametersFromDictionary:(NSDictionary *)inDictionary; 22 | + (NSDictionary *)parameterDictionaryFromString:(NSString *)inString; 23 | + (NSString *)parameterStringForParameters:(NSArray *)inParameters; 24 | + (NSString *)parameterStringForDictionary:(NSDictionary *)inParameterDictionary; 25 | 26 | - (id)initWithName:(NSString *)inName andValue:(NSString *)inValue; 27 | 28 | - (NSString *)URLEncodedParameterString; 29 | 30 | @end 31 | -------------------------------------------------------------------------------- /CocoParticle/DropboxSDK/MPOAuth/NSString+URLEscapingAdditions.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSString+URLEscapingAdditions.h 3 | // MPOAuthConnection 4 | // 5 | // Created by Karl Adam on 08.12.07. 6 | // Copyright 2008 matrixPointer. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | 12 | @interface NSString (MPURLEscapingAdditions) 13 | 14 | - (BOOL)isIPAddress; 15 | - (NSString *)stringByAddingURIPercentEscapesUsingEncoding:(NSStringEncoding)inEncoding; 16 | 17 | @end 18 | 19 | @interface NSURL (MPURLEscapingAdditions) 20 | - (NSString *)stringByAddingURIPercentEscapesUsingEncoding:(NSStringEncoding)inEncoding; 21 | @end 22 | -------------------------------------------------------------------------------- /CocoParticle/DropboxSDK/MPOAuth/NSString+URLEscapingAdditions.m: -------------------------------------------------------------------------------- 1 | // 2 | // NSString+URLEscapingAdditions.m 3 | // MPOAuthConnection 4 | // 5 | // Created by Karl Adam on 08.12.07. 6 | // Copyright 2008 matrixPointer. All rights reserved. 7 | // 8 | 9 | #import "NSString+URLEscapingAdditions.h" 10 | 11 | 12 | @implementation NSString (MPURLEscapingAdditions) 13 | 14 | - (BOOL)isIPAddress { 15 | BOOL isIPAddress = NO; 16 | NSArray *components = [self componentsSeparatedByString:@"."]; 17 | NSCharacterSet *invalidCharacters = [[NSCharacterSet characterSetWithCharactersInString:@"1234567890"] invertedSet]; 18 | 19 | if ([components count] == 4) { 20 | NSString *part1 = [components objectAtIndex:0]; 21 | NSString *part2 = [components objectAtIndex:1]; 22 | NSString *part3 = [components objectAtIndex:2]; 23 | NSString *part4 = [components objectAtIndex:3]; 24 | 25 | if ([part1 rangeOfCharacterFromSet:invalidCharacters].location == NSNotFound && 26 | [part2 rangeOfCharacterFromSet:invalidCharacters].location == NSNotFound && 27 | [part3 rangeOfCharacterFromSet:invalidCharacters].location == NSNotFound && 28 | [part4 rangeOfCharacterFromSet:invalidCharacters].location == NSNotFound ) { 29 | 30 | if ([part1 intValue] < 255 && 31 | [part2 intValue] < 255 && 32 | [part3 intValue] < 255 && 33 | [part4 intValue] < 255) { 34 | isIPAddress = YES; 35 | } 36 | } 37 | } 38 | 39 | return isIPAddress; 40 | } 41 | 42 | - (NSString *)stringByAddingURIPercentEscapesUsingEncoding:(NSStringEncoding)inEncoding { 43 | NSString *escapedString = (NSString *)CFURLCreateStringByAddingPercentEscapes(kCFAllocatorDefault, 44 | (CFStringRef)self, 45 | NULL, 46 | (CFStringRef)@":/?=,!$&'()*+;[]@#", 47 | CFStringConvertNSStringEncodingToEncoding(inEncoding)); 48 | 49 | return [escapedString autorelease]; 50 | } 51 | 52 | @end 53 | 54 | @implementation NSURL (MPURLEscapingAdditions) 55 | 56 | - (NSString *)stringByAddingURIPercentEscapesUsingEncoding:(NSStringEncoding)inEncoding { 57 | return [[self absoluteString] stringByAddingURIPercentEscapesUsingEncoding:inEncoding]; 58 | } 59 | 60 | @end 61 | -------------------------------------------------------------------------------- /CocoParticle/DropboxSDK/MPOAuth/NSURL+MPURLParameterAdditions.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSURL+MPURLParameterAdditions.h 3 | // MPOAuthConnection 4 | // 5 | // Created by Karl Adam on 08.12.08. 6 | // Copyright 2008 matrixPointer. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | 12 | @interface NSURL (MPURLParameterAdditions) 13 | 14 | - (NSURL *)urlByAddingParameters:(NSArray *)inParameters; 15 | - (NSURL *)urlByAddingParameterDictionary:(NSDictionary *)inParameters; 16 | - (NSURL *)urlByRemovingQuery; 17 | - (NSString *)absoluteNormalizedString; 18 | 19 | - (BOOL)domainMatches:(NSString *)inString; 20 | 21 | @end 22 | -------------------------------------------------------------------------------- /CocoParticle/DropboxSDK/MPOAuth/NSURLResponse+Encoding.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSURL+MPEncodingAdditions.h 3 | // MPOAuthConnection 4 | // 5 | // Created by Karl Adam on 08.12.05. 6 | // Copyright 2008 matrixPointer. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | 12 | @interface NSURLResponse (EncodingAdditions) 13 | - (NSStringEncoding)encoding; 14 | @end 15 | -------------------------------------------------------------------------------- /CocoParticle/DropboxSDK/MPOAuth/NSURLResponse+Encoding.m: -------------------------------------------------------------------------------- 1 | // 2 | // NSURL+MPEncodingAdditions.m 3 | // MPOAuthConnection 4 | // 5 | // Created by Karl Adam on 08.12.05. 6 | // Copyright 2008 matrixPointer. All rights reserved. 7 | // 8 | 9 | #import "NSURLResponse+Encoding.h" 10 | 11 | 12 | @implementation NSURLResponse (EncodingAdditions) 13 | 14 | - (NSStringEncoding)encoding { 15 | NSStringEncoding encoding = NSUTF8StringEncoding; 16 | 17 | if ([self textEncodingName]) { 18 | CFStringEncoding cfStringEncoding = CFStringConvertIANACharSetNameToEncoding((CFStringRef)[self textEncodingName]); 19 | if (cfStringEncoding != kCFStringEncodingInvalidId) { 20 | encoding = CFStringConvertEncodingToNSStringEncoding(cfStringEncoding); 21 | } 22 | } 23 | 24 | return encoding; 25 | } 26 | 27 | @end 28 | -------------------------------------------------------------------------------- /CocoParticle/DropboxSDK/NSString+Dropbox.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSString+Dropbox.h 3 | // DropboxSDK 4 | // 5 | // Created by Brian Smith on 7/19/10. 6 | // Copyright 2010 Dropbox, Inc. All rights reserved. 7 | // 8 | 9 | 10 | @interface NSString (Dropbox) 11 | 12 | // This will take a path for a resource and normalize so you can compare paths 13 | - (NSString*)normalizedDropboxPath; 14 | 15 | // Normalizes both paths and compares them 16 | - (BOOL)isEqualToDropboxPath:(NSString*)otherPath; 17 | 18 | @end 19 | -------------------------------------------------------------------------------- /CocoParticle/DropboxSDK/NSString+Dropbox.m: -------------------------------------------------------------------------------- 1 | // 2 | // NSString+Dropbox.m 3 | // DropboxSDK 4 | // 5 | // Created by Brian Smith on 7/19/10. 6 | // Copyright 2010 Dropbox, Inc. All rights reserved. 7 | // 8 | 9 | #import "NSString+Dropbox.h" 10 | 11 | 12 | @implementation NSString (Dropbox) 13 | 14 | - (NSString*)normalizedDropboxPath { 15 | if ([self isEqual:@"/"]) return @""; 16 | return [[self lowercaseString] precomposedStringWithCanonicalMapping]; 17 | } 18 | 19 | - (BOOL)isEqualToDropboxPath:(NSString*)otherPath { 20 | return [[self normalizedDropboxPath] isEqualToString:[otherPath normalizedDropboxPath]]; 21 | } 22 | 23 | @end 24 | -------------------------------------------------------------------------------- /CocoParticle/DropboxSDK/Resources/db_background.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tayl0r/CocoParticle/55f8223d918e0d6601b5fef7bed53bb99b763434/CocoParticle/DropboxSDK/Resources/db_background.png -------------------------------------------------------------------------------- /CocoParticle/DropboxSDK/Resources/db_create_account.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tayl0r/CocoParticle/55f8223d918e0d6601b5fef7bed53bb99b763434/CocoParticle/DropboxSDK/Resources/db_create_account.png -------------------------------------------------------------------------------- /CocoParticle/DropboxSDK/Resources/db_create_account@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tayl0r/CocoParticle/55f8223d918e0d6601b5fef7bed53bb99b763434/CocoParticle/DropboxSDK/Resources/db_create_account@2x.png -------------------------------------------------------------------------------- /CocoParticle/DropboxSDK/Resources/db_create_account_button.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tayl0r/CocoParticle/55f8223d918e0d6601b5fef7bed53bb99b763434/CocoParticle/DropboxSDK/Resources/db_create_account_button.png -------------------------------------------------------------------------------- /CocoParticle/DropboxSDK/Resources/db_create_account_button_down.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tayl0r/CocoParticle/55f8223d918e0d6601b5fef7bed53bb99b763434/CocoParticle/DropboxSDK/Resources/db_create_account_button_down.png -------------------------------------------------------------------------------- /CocoParticle/DropboxSDK/Resources/db_link_button.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tayl0r/CocoParticle/55f8223d918e0d6601b5fef7bed53bb99b763434/CocoParticle/DropboxSDK/Resources/db_link_button.png -------------------------------------------------------------------------------- /CocoParticle/DropboxSDK/Resources/db_link_button_down.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tayl0r/CocoParticle/55f8223d918e0d6601b5fef7bed53bb99b763434/CocoParticle/DropboxSDK/Resources/db_link_button_down.png -------------------------------------------------------------------------------- /CocoParticle/DropboxSDK/Resources/db_link_header.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tayl0r/CocoParticle/55f8223d918e0d6601b5fef7bed53bb99b763434/CocoParticle/DropboxSDK/Resources/db_link_header.png -------------------------------------------------------------------------------- /CocoParticle/DropboxSDK/Resources/db_link_header@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tayl0r/CocoParticle/55f8223d918e0d6601b5fef7bed53bb99b763434/CocoParticle/DropboxSDK/Resources/db_link_header@2x.png -------------------------------------------------------------------------------- /CocoParticle/DropboxSDK/Resources/db_logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tayl0r/CocoParticle/55f8223d918e0d6601b5fef7bed53bb99b763434/CocoParticle/DropboxSDK/Resources/db_logo.png -------------------------------------------------------------------------------- /CocoParticle/DropboxSDK/Resources/db_logo@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tayl0r/CocoParticle/55f8223d918e0d6601b5fef7bed53bb99b763434/CocoParticle/DropboxSDK/Resources/db_logo@2x.png -------------------------------------------------------------------------------- /CocoParticle/GameConfig.h: -------------------------------------------------------------------------------- 1 | // 2 | // GameConfig.h 3 | // CocoParticle 4 | // 5 | // Created by Taylor Steil on 7/10/11. 6 | // Copyright __MyCompanyName__ 2011. All rights reserved. 7 | // 8 | 9 | #ifndef __GAME_CONFIG_H 10 | #define __GAME_CONFIG_H 11 | 12 | // 13 | // Supported Autorotations: 14 | // None, 15 | // UIViewController, 16 | // CCDirector 17 | // 18 | #define kGameAutorotationNone 0 19 | #define kGameAutorotationCCDirector 1 20 | #define kGameAutorotationUIViewController 2 21 | 22 | // 23 | // Define here the type of autorotation that you want for your game 24 | // 25 | 26 | // 3rd generation and newer devices: Rotate using UIViewController. Rotation should be supported on iPad apps. 27 | // TIP: 28 | // To improve the performance, you should set this value to "kGameAutorotationNone" or "kGameAutorotationCCDirector" 29 | #if defined(__ARM_NEON__) || TARGET_IPHONE_SIMULATOR 30 | #define GAME_AUTOROTATION kGameAutorotationUIViewController 31 | 32 | // ARMv6 (1st and 2nd generation devices): Don't rotate. It is very expensive 33 | #elif __arm__ 34 | #define GAME_AUTOROTATION kGameAutorotationNone 35 | 36 | 37 | // Ignore this value on Mac 38 | #elif defined(__MAC_OS_X_VERSION_MAX_ALLOWED) 39 | 40 | #else 41 | #error(unknown architecture) 42 | #endif 43 | 44 | #endif // __GAME_CONFIG_H 45 | 46 | -------------------------------------------------------------------------------- /CocoParticle/HelloWorldLayer.h: -------------------------------------------------------------------------------- 1 | // 2 | // HelloWorldLayer.h 3 | // CocoParticle 4 | // 5 | // Created by Taylor Steil on 7/10/11. 6 | // Copyright __MyCompanyName__ 2011. All rights reserved. 7 | // 8 | 9 | 10 | // When you import this file, you import all the cocos2d classes 11 | #import "cocos2d.h" 12 | 13 | // HelloWorldLayer 14 | @interface HelloWorldLayer : CCLayer 15 | { 16 | } 17 | 18 | // returns a CCScene that contains the HelloWorldLayer as the only child 19 | +(CCScene *) scene; 20 | 21 | @end 22 | -------------------------------------------------------------------------------- /CocoParticle/HelloWorldLayer.m: -------------------------------------------------------------------------------- 1 | // 2 | // HelloWorldLayer.m 3 | // CocoParticle 4 | // 5 | // Created by Taylor Steil on 7/10/11. 6 | // Copyright __MyCompanyName__ 2011. All rights reserved. 7 | // 8 | 9 | 10 | // Import the interfaces 11 | #import "HelloWorldLayer.h" 12 | 13 | // HelloWorldLayer implementation 14 | @implementation HelloWorldLayer 15 | 16 | +(CCScene *) scene 17 | { 18 | // 'scene' is an autorelease object. 19 | CCScene *scene = [CCScene node]; 20 | 21 | // 'layer' is an autorelease object. 22 | HelloWorldLayer *layer = [HelloWorldLayer node]; 23 | 24 | // add layer as a child to scene 25 | [scene addChild: layer]; 26 | 27 | // return the scene 28 | return scene; 29 | } 30 | 31 | // on "init" you need to initialize your instance 32 | -(id) init 33 | { 34 | // always call "super" init 35 | // Apple recommends to re-assign "self" with the "super" return value 36 | if( (self=[super init])) { 37 | 38 | // create and initialize a Label 39 | CCLabelTTF *label = [CCLabelTTF labelWithString:@"Hello World" fontName:@"Marker Felt" fontSize:64]; 40 | 41 | // ask director the the window size 42 | CGSize size = [[CCDirector sharedDirector] winSize]; 43 | 44 | // position the label on the center of the screen 45 | label.position = ccp( size.width /2 , size.height/2 ); 46 | 47 | // add the label as a child to this Layer 48 | [self addChild: label]; 49 | } 50 | return self; 51 | } 52 | 53 | // on "dealloc" you need to release all your retained objects 54 | - (void) dealloc 55 | { 56 | // in case you have something to dealloc, do it in this method 57 | // in this particular example nothing needs to be released. 58 | // cocos2d will automatically release all the children (Label) 59 | 60 | // don't forget to call "super dealloc" 61 | [super dealloc]; 62 | } 63 | @end 64 | -------------------------------------------------------------------------------- /CocoParticle/ParticleConfig.h: -------------------------------------------------------------------------------- 1 | #define SAVE_PARTICLES_TO_DISK @"save particles to disk!" 2 | #define PARTICLE_LIST_VIEW_DID_APPEAR @"list view did appear!" 3 | #define SAVE_PARTICLE_TO_CLOUD @"save particle to cloud!" 4 | #define COCOS_PARTICLE_CLOUD_FOLDER @"/CocosParticleSavedData" -------------------------------------------------------------------------------- /CocoParticle/ParticleEditor.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | #import "ParticleEditorComponentManager.h" 4 | 5 | @interface ParticleEditor : UITableViewController { 6 | ParticleEditorComponentManager* m_componentManager; 7 | ParticleEditorComponent* m_name; 8 | } 9 | 10 | -(void) loadEditor; 11 | -(void) unloadEditor; 12 | -(NSString*) getName; 13 | -(NSDictionary*) toDict; 14 | -(void) readValuesFromDict:(NSDictionary*)dict; 15 | 16 | @end 17 | -------------------------------------------------------------------------------- /CocoParticle/ParticleEditorComponent.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import "ParticleEditorComponent.h" 3 | 4 | #define CREATE_PARTICLE_MESSAGE @"create particle!" 5 | #define ANY_VALUE_CHANGED @"any value changed" 6 | 7 | @interface ParticleEditorComponent : NSObject { 8 | NSString* m_name; 9 | NSString* m_key; 10 | NSInteger m_type; 11 | UIView* m_widget; 12 | UITextField* m_widgetValue; 13 | CGFloat m_height; 14 | NSArray* m_segments; 15 | UITableViewCell* m_cell; 16 | BOOL m_scaleFlag; 17 | float m_floatValue; 18 | float m_maxFloat; 19 | float m_minFloat; 20 | BOOL m_respectMin; 21 | float m_lastSliderValue; 22 | BOOL m_locked; 23 | } 24 | 25 | @property (readonly) NSInteger m_type; 26 | @property (readonly) NSString* m_name; 27 | @property (readonly) NSString* m_key; 28 | @property (readwrite, assign) UIView* m_widget; 29 | @property (readwrite, assign) UITextField* m_widgetValue; 30 | @property (readwrite) CGFloat m_height; 31 | @property (readwrite, retain) UITableViewCell* m_cell; 32 | 33 | -(id) initWithName:(NSString*)name key:(NSString*)key; 34 | -(void) anyValueChanged; 35 | -(id) getValue; 36 | -(void) setValue:(NSObject*)obj; 37 | -(void) releaseWidget; 38 | -(void) setSliderWithMin:(CGFloat)min andMax:(CGFloat)max; 39 | -(void) setSliderWithMin:(CGFloat)min andMax:(CGFloat)max andScaleFlag:(BOOL)scaleFlag; 40 | -(void) setSliderWithMin:(CGFloat)min andMax:(CGFloat)max andRespectMin:(BOOL)respectMinFlag; 41 | -(void) setSliderWithMin:(CGFloat)min andMax:(CGFloat)max andScaleFlag:(BOOL)scaleFlag andRespectMin:(BOOL)respectMinFlag; 42 | -(void) setWidgetValue:(CGFloat)value; 43 | 44 | -(void) sliderChanged:(UISlider*)slider; 45 | -(void) updateSlider:(float)value; 46 | -(void) updateSliderDone:(UISlider*)slider; 47 | 48 | -(void) setTextInputWithDefault:(NSString*)text; 49 | -(void) setSegmentedControlWithChoices:(NSArray*)choices; 50 | -(void) segmentedControlChanged:(UISegmentedControl*)seg; 51 | 52 | -(void) randomize; 53 | 54 | @end -------------------------------------------------------------------------------- /CocoParticle/ParticleEditorComponentManager.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import "ParticleEditorSection.h" 3 | 4 | @interface ParticleEditorComponentManager : NSObject { 5 | NSMutableArray* m_sections; 6 | BOOL m_isVisible; 7 | NSDate* m_createdDate; 8 | } 9 | 10 | -(void) setIsVisible:(BOOL)flag; 11 | -(NSUInteger) getSectionCount; 12 | -(ParticleEditorSection*) getSection:(NSUInteger)idx; 13 | -(ParticleEditorSection*) addSectionWithName:(NSString*)name; 14 | -(NSDictionary*) toDict; 15 | -(id) toPropertyList; 16 | -(void) anyValueChanged; 17 | -(void) readValuesFromDict:(NSDictionary*)dict; 18 | -(void) randomize; 19 | 20 | @end -------------------------------------------------------------------------------- /CocoParticle/ParticleEditorSection.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import "ParticleEditorComponent.h" 3 | 4 | @interface ParticleEditorSection : NSObject { 5 | id m_manager; 6 | NSString* m_name; 7 | NSMutableArray* m_components; 8 | } 9 | 10 | @property (readonly) NSString* m_name; 11 | @property (readonly) NSArray* m_components; 12 | 13 | -(id) initWithName:(NSString*)name; 14 | -(NSUInteger) getComponentCount; 15 | -(ParticleEditorComponent*) getComponent:(NSUInteger)idx; 16 | -(ParticleEditorComponent*) addComponentWithName:(NSString*)name key:(NSString*)key; 17 | 18 | @end -------------------------------------------------------------------------------- /CocoParticle/ParticleEditorSection.m: -------------------------------------------------------------------------------- 1 | #import "ParticleEditorSection.h" 2 | 3 | 4 | @implementation ParticleEditorSection 5 | 6 | @synthesize m_name, m_components; 7 | 8 | -(id) initWithName:(NSString*)name 9 | { 10 | if ((self = [super init])) { 11 | m_components = [[NSMutableArray alloc] init]; 12 | m_name = [name retain]; 13 | } 14 | return self; 15 | } 16 | 17 | -(NSUInteger) getComponentCount 18 | { 19 | return [m_components count]; 20 | } 21 | 22 | -(ParticleEditorComponent*) getComponent:(NSUInteger)idx 23 | { 24 | return [m_components objectAtIndex:idx]; 25 | } 26 | 27 | -(ParticleEditorComponent*) addComponentWithName:(NSString*)name key:(NSString *)key 28 | { 29 | ParticleEditorComponent* component = [[[ParticleEditorComponent alloc] initWithName:name key:key] autorelease]; 30 | [m_components addObject:component]; 31 | return component; 32 | } 33 | 34 | -(void) dealloc 35 | { 36 | [m_components release]; 37 | m_components = nil; 38 | [m_name release]; 39 | m_name = nil; 40 | [super dealloc]; 41 | } 42 | 43 | @end -------------------------------------------------------------------------------- /CocoParticle/ParticleList.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | @interface ParticleList : UITableViewController { 4 | NSMutableArray* m_particles; 5 | UITabBarController* m_tabBar; 6 | BOOL m_singleEdit; 7 | } 8 | 9 | -(void) editRows; 10 | -(void) addRowAtPath:(NSIndexPath*)path; 11 | -(void) saveParticlesToDisk; 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /CocoParticle/ParticlePreview.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import "cocos2d.h" 3 | #import "TSParticleSystemQuad.h" 4 | 5 | #import "ParticleList.h" 6 | 7 | @interface CocosParticlePreview : CCLayer { 8 | //NSMutableArray* m_activeParticles; 9 | CCNode* m_activeParticle; 10 | NSDictionary* m_pdata; 11 | } 12 | 13 | +(CCScene*) scene; 14 | -(void) createParticle:(NSNotification*)notif; 15 | -(void) drawParticle; 16 | 17 | @end 18 | -------------------------------------------------------------------------------- /CocoParticle/ParticlePreview.m: -------------------------------------------------------------------------------- 1 | #import "ParticlePreview.h" 2 | #import "ParticleEditorComponent.h" 3 | 4 | @implementation CocosParticlePreview 5 | 6 | +(CCScene*) scene 7 | { 8 | CCScene *scene = [CCScene node]; 9 | CocosParticlePreview *layer = [[[CocosParticlePreview alloc] init] autorelease]; 10 | [scene addChild:layer]; 11 | return scene; 12 | } 13 | 14 | -(id) init 15 | { 16 | if ((self = [super init])) { 17 | [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(createParticle:) name:CREATE_PARTICLE_MESSAGE object:nil]; 18 | //m_activeParticles = [[NSMutableArray alloc] init]; 19 | } 20 | return self; 21 | } 22 | 23 | -(void) createParticle:(NSNotification*)notif 24 | { 25 | /*for (CCParticleSystemQuad* p in m_activeParticles) { 26 | [p removeFromParentAndCleanup:YES]; 27 | }*/ 28 | if (m_activeParticle) { 29 | [m_activeParticle removeFromParentAndCleanup:YES]; 30 | } 31 | [self unschedule:@selector(drawParticle)]; 32 | 33 | if (m_pdata) { 34 | [m_pdata release]; 35 | m_pdata = nil; 36 | } 37 | m_pdata = [[notif userInfo] retain]; 38 | [self drawParticle]; 39 | 40 | // schedule a new particle every 41 | NSNumber* particleLife = [m_pdata objectForKey:@"particleLifespan"]; 42 | NSNumber* systemDuration = [m_pdata objectForKey:@"duration"]; 43 | [self schedule:@selector(drawParticle) interval:[particleLife floatValue] + [systemDuration floatValue]]; 44 | } 45 | 46 | -(void) drawParticle 47 | { 48 | TSParticleSystemQuad* p = [[[TSParticleSystemQuad alloc] initWithDictionary:m_pdata] autorelease]; 49 | [self addChild:p]; 50 | CGSize size = [[CCDirector sharedDirector] winSize]; 51 | p.position = ccp(size.width/2, size.height/2); 52 | m_activeParticle = p; 53 | //[m_activeParticles addObject:p]; 54 | } 55 | 56 | - (void) dealloc 57 | { 58 | CCLOGERROR(@"particle preview getting dealloc'd...."); 59 | //[m_activeParticles release]; 60 | //m_activeParticles = nil; 61 | [self unscheduleAllSelectors]; 62 | if (m_pdata) { 63 | [m_pdata release]; 64 | m_pdata = nil; 65 | } 66 | [[NSNotificationCenter defaultCenter] removeObserver:self name:CREATE_PARTICLE_MESSAGE object:nil]; 67 | [super dealloc]; 68 | } 69 | 70 | @end 71 | -------------------------------------------------------------------------------- /CocoParticle/Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header for all source files of the 'Test' target in the 'Test' project 3 | // 4 | 5 | #import 6 | 7 | #ifndef __IPHONE_3_0 8 | #warning "This project uses features only available in iPhone SDK 3.0 and later." 9 | #endif 10 | 11 | #ifdef __OBJC__ 12 | #import 13 | #import 14 | #endif 15 | -------------------------------------------------------------------------------- /CocoParticle/Resources/Default.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tayl0r/CocoParticle/55f8223d918e0d6601b5fef7bed53bb99b763434/CocoParticle/Resources/Default.png -------------------------------------------------------------------------------- /CocoParticle/Resources/Icon-72.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tayl0r/CocoParticle/55f8223d918e0d6601b5fef7bed53bb99b763434/CocoParticle/Resources/Icon-72.png -------------------------------------------------------------------------------- /CocoParticle/Resources/Icon-Small-50.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tayl0r/CocoParticle/55f8223d918e0d6601b5fef7bed53bb99b763434/CocoParticle/Resources/Icon-Small-50.png -------------------------------------------------------------------------------- /CocoParticle/Resources/Icon-Small.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tayl0r/CocoParticle/55f8223d918e0d6601b5fef7bed53bb99b763434/CocoParticle/Resources/Icon-Small.png -------------------------------------------------------------------------------- /CocoParticle/Resources/Icon-Small@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tayl0r/CocoParticle/55f8223d918e0d6601b5fef7bed53bb99b763434/CocoParticle/Resources/Icon-Small@2x.png -------------------------------------------------------------------------------- /CocoParticle/Resources/Icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tayl0r/CocoParticle/55f8223d918e0d6601b5fef7bed53bb99b763434/CocoParticle/Resources/Icon.png -------------------------------------------------------------------------------- /CocoParticle/Resources/Icon@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tayl0r/CocoParticle/55f8223d918e0d6601b5fef7bed53bb99b763434/CocoParticle/Resources/Icon@2x.png -------------------------------------------------------------------------------- /CocoParticle/Resources/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | English 7 | CFBundleDisplayName 8 | ${PRODUCT_NAME} 9 | CFBundleExecutable 10 | ${EXECUTABLE_NAME} 11 | CFBundleIconFile 12 | 13 | CFBundleIconFiles 14 | 15 | Icon.png 16 | Icon@2x.png 17 | Icon-72.png 18 | Icon-Small-50.png 19 | Icon-Small.png 20 | Icon-Small@2x.png 21 | 22 | CFBundleIdentifier 23 | com.yourcompany.${PRODUCT_NAME:rfc1034identifier} 24 | CFBundleInfoDictionaryVersion 25 | 6.0 26 | CFBundleName 27 | ${PRODUCT_NAME} 28 | CFBundlePackageType 29 | APPL 30 | CFBundleSignature 31 | ???? 32 | CFBundleVersion 33 | 1.0 34 | LSRequiresIPhoneOS 35 | 36 | UIPrerenderedIcon 37 | 38 | UIRequiredDeviceCapabilities 39 | 40 | accelerometer 41 | 42 | opengles-1 43 | 44 | 45 | UIStatusBarHidden 46 | 47 | UISupportedInterfaceOrientations 48 | 49 | UIInterfaceOrientationLandscapeLeft 50 | UIInterfaceOrientationLandscapeRight 51 | 52 | 53 | 54 | -------------------------------------------------------------------------------- /CocoParticle/Resources/fire.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tayl0r/CocoParticle/55f8223d918e0d6601b5fef7bed53bb99b763434/CocoParticle/Resources/fire.png -------------------------------------------------------------------------------- /CocoParticle/Resources/fps_images.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tayl0r/CocoParticle/55f8223d918e0d6601b5fef7bed53bb99b763434/CocoParticle/Resources/fps_images.png -------------------------------------------------------------------------------- /CocoParticle/Resources/iTunesArtwork: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tayl0r/CocoParticle/55f8223d918e0d6601b5fef7bed53bb99b763434/CocoParticle/Resources/iTunesArtwork -------------------------------------------------------------------------------- /CocoParticle/RootViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // RootViewController.h 3 | // CocoParticle 4 | // 5 | // Created by Taylor Steil on 7/10/11. 6 | // Copyright __MyCompanyName__ 2011. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | 12 | @interface RootViewController : UIViewController { 13 | 14 | } 15 | 16 | @end 17 | -------------------------------------------------------------------------------- /CocoParticle/applications_app.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tayl0r/CocoParticle/55f8223d918e0d6601b5fef7bed53bb99b763434/CocoParticle/applications_app.png -------------------------------------------------------------------------------- /CocoParticle/brush_painting.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tayl0r/CocoParticle/55f8223d918e0d6601b5fef7bed53bb99b763434/CocoParticle/brush_painting.png -------------------------------------------------------------------------------- /CocoParticle/db.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tayl0r/CocoParticle/55f8223d918e0d6601b5fef7bed53bb99b763434/CocoParticle/db.png -------------------------------------------------------------------------------- /CocoParticle/libs/CocosDenshion/CDConfig.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2010 Steve Oldmeadow 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining a copy 5 | of this software and associated documentation files (the "Software"), to deal 6 | in the Software without restriction, including without limitation the rights 7 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | copies of the Software, and to permit persons to whom the Software is 9 | furnished to do so, subject to the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be included in 12 | all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | THE SOFTWARE. 21 | 22 | $Id$ 23 | */ 24 | #define COCOSDENSHION_VERSION "Aphex.rc" 25 | 26 | 27 | /** 28 | If enabled code useful for debugging such as parameter check assertions will be performed. 29 | If you experience any problems you should enable this and test your code with a debug build. 30 | */ 31 | //#define CD_DEBUG 1 32 | 33 | /** 34 | The total number of sounds/buffers that can be loaded assuming memory is sufficient 35 | */ 36 | //Number of buffers slots that will be initially created 37 | #define CD_BUFFERS_START 64 38 | //Number of buffers that will be added 39 | #define CD_BUFFERS_INCREMENT 16 40 | 41 | /** 42 | If enabled, OpenAL code will use static buffers. When static buffers are used the audio 43 | data is managed outside of OpenAL, this eliminates a memcpy operation which leads to 44 | higher performance when loading sounds. 45 | 46 | However, the downside is that when the audio data is freed you must 47 | be certain that it is no longer being accessed otherwise your app will crash. Testing on OS 2.2.1 48 | and 3.1.2 has shown that this may occur if a buffer is being used by a source with state = AL_PLAYING 49 | when the buffer is deleted. If the data is freed too quickly after the source is stopped then 50 | a crash will occur. The implemented workaround is that when static buffers are used the unloadBuffer code will wait for 51 | any playing sources to finish playing before the associated buffer and data are deleted, however, this delay may negate any 52 | performance gains that are achieved during loading. 53 | 54 | Performance tests on a 1st gen iPod running OS 2.2.1 loading the CocosDenshionDemo sounds were ~0.14 seconds without 55 | static buffers and ~0.12 seconds when using static buffers. 56 | 57 | */ 58 | //#define CD_USE_STATIC_BUFFERS 1 59 | 60 | 61 | -------------------------------------------------------------------------------- /CocoParticle/libs/FontLabel/FontLabel.h: -------------------------------------------------------------------------------- 1 | // 2 | // FontLabel.h 3 | // FontLabel 4 | // 5 | // Created by Kevin Ballard on 5/8/09. 6 | // Copyright © 2009 Zynga Game Networks 7 | // 8 | // 9 | // Licensed under the Apache License, Version 2.0 (the "License"); 10 | // you may not use this file except in compliance with the License. 11 | // You may obtain a copy of the License at 12 | // 13 | // http://www.apache.org/licenses/LICENSE-2.0 14 | // 15 | // Unless required by applicable law or agreed to in writing, software 16 | // distributed under the License is distributed on an "AS IS" BASIS, 17 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | // See the License for the specific language governing permissions and 19 | // limitations under the License. 20 | // 21 | 22 | #import 23 | #import 24 | 25 | @class ZFont; 26 | @class ZAttributedString; 27 | 28 | @interface FontLabel : UILabel { 29 | void *reserved; // works around a bug in UILabel 30 | ZFont *zFont; 31 | ZAttributedString *zAttributedText; 32 | } 33 | @property (nonatomic, setter=setCGFont:) CGFontRef cgFont __AVAILABILITY_INTERNAL_DEPRECATED; 34 | @property (nonatomic, assign) CGFloat pointSize __AVAILABILITY_INTERNAL_DEPRECATED; 35 | @property (nonatomic, retain, setter=setZFont:) ZFont *zFont; 36 | // if attributedText is nil, fall back on using the inherited UILabel properties 37 | // if attributedText is non-nil, the font/text/textColor 38 | // in addition, adjustsFontSizeToFitWidth does not work with attributed text 39 | @property (nonatomic, copy) ZAttributedString *zAttributedText; 40 | // -initWithFrame:fontName:pointSize: uses FontManager to look up the font name 41 | - (id)initWithFrame:(CGRect)frame fontName:(NSString *)fontName pointSize:(CGFloat)pointSize; 42 | - (id)initWithFrame:(CGRect)frame zFont:(ZFont *)font; 43 | - (id)initWithFrame:(CGRect)frame font:(CGFontRef)font pointSize:(CGFloat)pointSize __AVAILABILITY_INTERNAL_DEPRECATED; 44 | @end 45 | -------------------------------------------------------------------------------- /CocoParticle/libs/FontLabel/ZAttributedStringPrivate.h: -------------------------------------------------------------------------------- 1 | // 2 | // ZAttributedStringPrivate.h 3 | // FontLabel 4 | // 5 | // Created by Kevin Ballard on 9/23/09. 6 | // Copyright 2009 Zynga Game Networks. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "ZAttributedString.h" 11 | 12 | @interface ZAttributeRun : NSObject { 13 | NSUInteger _index; 14 | NSMutableDictionary *_attributes; 15 | } 16 | @property (nonatomic, readonly) NSUInteger index; 17 | @property (nonatomic, readonly) NSMutableDictionary *attributes; 18 | + (id)attributeRunWithIndex:(NSUInteger)idx attributes:(NSDictionary *)attrs; 19 | - (id)initWithIndex:(NSUInteger)idx attributes:(NSDictionary *)attrs; 20 | @end 21 | 22 | @interface ZAttributedString (ZAttributedStringPrivate) 23 | @property (nonatomic, readonly) NSArray *attributes; 24 | @end 25 | -------------------------------------------------------------------------------- /CocoParticle/libs/FontLabel/ZFont.h: -------------------------------------------------------------------------------- 1 | // 2 | // ZFont.h 3 | // FontLabel 4 | // 5 | // Created by Kevin Ballard on 7/2/09. 6 | // Copyright © 2009 Zynga Game Networks 7 | // 8 | // 9 | // Licensed under the Apache License, Version 2.0 (the "License"); 10 | // you may not use this file except in compliance with the License. 11 | // You may obtain a copy of the License at 12 | // 13 | // http://www.apache.org/licenses/LICENSE-2.0 14 | // 15 | // Unless required by applicable law or agreed to in writing, software 16 | // distributed under the License is distributed on an "AS IS" BASIS, 17 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | // See the License for the specific language governing permissions and 19 | // limitations under the License. 20 | // 21 | 22 | #import 23 | #import 24 | 25 | @interface ZFont : NSObject { 26 | CGFontRef _cgFont; 27 | CGFloat _pointSize; 28 | CGFloat _ratio; 29 | NSString *_familyName; 30 | NSString *_fontName; 31 | NSString *_postScriptName; 32 | } 33 | @property (nonatomic, readonly) CGFontRef cgFont; 34 | @property (nonatomic, readonly) CGFloat pointSize; 35 | @property (nonatomic, readonly) CGFloat ascender; 36 | @property (nonatomic, readonly) CGFloat descender; 37 | @property (nonatomic, readonly) CGFloat leading; 38 | @property (nonatomic, readonly) CGFloat xHeight; 39 | @property (nonatomic, readonly) CGFloat capHeight; 40 | @property (nonatomic, readonly) NSString *familyName; 41 | @property (nonatomic, readonly) NSString *fontName; 42 | @property (nonatomic, readonly) NSString *postScriptName; 43 | + (ZFont *)fontWithCGFont:(CGFontRef)cgFont size:(CGFloat)fontSize; 44 | + (ZFont *)fontWithUIFont:(UIFont *)uiFont; 45 | - (id)initWithCGFont:(CGFontRef)cgFont size:(CGFloat)fontSize; 46 | - (ZFont *)fontWithSize:(CGFloat)fontSize; 47 | @end 48 | -------------------------------------------------------------------------------- /CocoParticle/libs/LICENSE_CocosDenshion.txt: -------------------------------------------------------------------------------- 1 | CocosDenshion Sound Engine 2 | 3 | Copyright (c) 2010 Steve Oldmeadow 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. -------------------------------------------------------------------------------- /CocoParticle/libs/LICENSE_TouchJSON.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2008 Jonathan Wight 2 | 3 | Permission is hereby granted, free of charge, to any person 4 | obtaining a copy of this software and associated documentation 5 | files (the "Software"), to deal in the Software without 6 | restriction, including without limitation the rights to use, 7 | copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | copies of the Software, and to permit persons to whom the 9 | Software is furnished to do so, subject to the following 10 | conditions: 11 | 12 | The above copyright notice and this permission notice shall be 13 | included in all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 17 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 19 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 20 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 21 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 22 | OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------- /CocoParticle/libs/LICENSE_cocos2d.txt: -------------------------------------------------------------------------------- 1 | cocos2d for iPhone: http://www.cocos2d-iphone.org 2 | 3 | Copyright (c) 2008-2011 - Ricardo Quesada and contributors 4 | (see each file to see the different copyright owners) 5 | 6 | 7 | Permission is hereby granted, free of charge, to any person obtaining a copy 8 | of this software and associated documentation files (the "Software"), to deal 9 | in the Software without restriction, including without limitation the rights 10 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | copies of the Software, and to permit persons to whom the Software is 12 | furnished to do so, subject to the following conditions: 13 | 14 | The above copyright notice and this permission notice shall be included in 15 | all copies or substantial portions of the Software. 16 | 17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23 | THE SOFTWARE. 24 | -------------------------------------------------------------------------------- /CocoParticle/libs/TouchJSON/CDataScanner.h: -------------------------------------------------------------------------------- 1 | // 2 | // CDataScanner.h 3 | // TouchCode 4 | // 5 | // Created by Jonathan Wight on 04/16/08. 6 | // Copyright 2008 toxicsoftware.com. All rights reserved. 7 | // 8 | // Permission is hereby granted, free of charge, to any person 9 | // obtaining a copy of this software and associated documentation 10 | // files (the "Software"), to deal in the Software without 11 | // restriction, including without limitation the rights to use, 12 | // copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | // copies of the Software, and to permit persons to whom the 14 | // Software is furnished to do so, subject to the following 15 | // conditions: 16 | // 17 | // The above copyright notice and this permission notice shall be 18 | // included in all copies or substantial portions of the Software. 19 | // 20 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 21 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 22 | // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 23 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 24 | // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 25 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 26 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 27 | // OTHER DEALINGS IN THE SOFTWARE. 28 | // 29 | 30 | #import 31 | 32 | // NSScanner 33 | 34 | @interface CDataScanner : NSObject { 35 | NSData *data; 36 | 37 | u_int8_t *start; 38 | u_int8_t *end; 39 | u_int8_t *current; 40 | NSUInteger length; 41 | } 42 | 43 | @property (readwrite, nonatomic, retain) NSData *data; 44 | @property (readwrite, nonatomic, assign) NSUInteger scanLocation; 45 | @property (readonly, nonatomic, assign) NSUInteger bytesRemaining; 46 | @property (readonly, nonatomic, assign) BOOL isAtEnd; 47 | 48 | - (id)initWithData:(NSData *)inData; 49 | 50 | - (unichar)currentCharacter; 51 | - (unichar)scanCharacter; 52 | - (BOOL)scanCharacter:(unichar)inCharacter; 53 | 54 | - (BOOL)scanUTF8String:(const char *)inString intoString:(NSString **)outValue; 55 | - (BOOL)scanString:(NSString *)inString intoString:(NSString **)outValue; 56 | - (BOOL)scanCharactersFromSet:(NSCharacterSet *)inSet intoString:(NSString **)outValue; // inSet must only contain 7-bit ASCII characters 57 | 58 | - (BOOL)scanUpToString:(NSString *)string intoString:(NSString **)outValue; 59 | - (BOOL)scanUpToCharactersFromSet:(NSCharacterSet *)set intoString:(NSString **)outValue; // inSet must only contain 7-bit ASCII characters 60 | 61 | - (BOOL)scanNumber:(NSNumber **)outValue; 62 | - (BOOL)scanDecimalNumber:(NSDecimalNumber **)outValue; 63 | 64 | - (BOOL)scanDataOfLength:(NSUInteger)inLength intoData:(NSData **)outData; 65 | 66 | - (void)skipWhitespace; 67 | 68 | - (NSString *)remainingString; 69 | - (NSData *)remainingData; 70 | 71 | @end 72 | -------------------------------------------------------------------------------- /CocoParticle/libs/TouchJSON/Extensions/CDataScanner_Extensions.h: -------------------------------------------------------------------------------- 1 | // 2 | // CDataScanner_Extensions.h 3 | // TouchCode 4 | // 5 | // Created by Jonathan Wight on 12/08/2005. 6 | // Copyright 2005 toxicsoftware.com. All rights reserved. 7 | // 8 | // Permission is hereby granted, free of charge, to any person 9 | // obtaining a copy of this software and associated documentation 10 | // files (the "Software"), to deal in the Software without 11 | // restriction, including without limitation the rights to use, 12 | // copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | // copies of the Software, and to permit persons to whom the 14 | // Software is furnished to do so, subject to the following 15 | // conditions: 16 | // 17 | // The above copyright notice and this permission notice shall be 18 | // included in all copies or substantial portions of the Software. 19 | // 20 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 21 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 22 | // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 23 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 24 | // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 25 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 26 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 27 | // OTHER DEALINGS IN THE SOFTWARE. 28 | // 29 | 30 | #import "CDataScanner.h" 31 | 32 | @interface CDataScanner (CDataScanner_Extensions) 33 | 34 | - (BOOL)scanCStyleComment:(NSString **)outComment; 35 | - (BOOL)scanCPlusPlusStyleComment:(NSString **)outComment; 36 | 37 | - (NSUInteger)lineOfScanLocation; 38 | - (NSDictionary *)userInfoForScanLocation; 39 | 40 | @end 41 | -------------------------------------------------------------------------------- /CocoParticle/libs/TouchJSON/Extensions/NSDictionary_JSONExtensions.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSDictionary_JSONExtensions.h 3 | // TouchCode 4 | // 5 | // Created by Jonathan Wight on 04/17/08. 6 | // Copyright 2008 toxicsoftware.com. All rights reserved. 7 | // 8 | // Permission is hereby granted, free of charge, to any person 9 | // obtaining a copy of this software and associated documentation 10 | // files (the "Software"), to deal in the Software without 11 | // restriction, including without limitation the rights to use, 12 | // copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | // copies of the Software, and to permit persons to whom the 14 | // Software is furnished to do so, subject to the following 15 | // conditions: 16 | // 17 | // The above copyright notice and this permission notice shall be 18 | // included in all copies or substantial portions of the Software. 19 | // 20 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 21 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 22 | // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 23 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 24 | // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 25 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 26 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 27 | // OTHER DEALINGS IN THE SOFTWARE. 28 | // 29 | 30 | #import 31 | 32 | @interface NSDictionary (NSDictionary_JSONExtensions) 33 | 34 | + (id)dictionaryWithJSONData:(NSData *)inData error:(NSError **)outError; 35 | + (id)dictionaryWithJSONString:(NSString *)inJSON error:(NSError **)outError; 36 | 37 | @end 38 | -------------------------------------------------------------------------------- /CocoParticle/libs/TouchJSON/Extensions/NSDictionary_JSONExtensions.m: -------------------------------------------------------------------------------- 1 | // 2 | // NSDictionary_JSONExtensions.m 3 | // TouchCode 4 | // 5 | // Created by Jonathan Wight on 04/17/08. 6 | // Copyright 2008 toxicsoftware.com. All rights reserved. 7 | // 8 | // Permission is hereby granted, free of charge, to any person 9 | // obtaining a copy of this software and associated documentation 10 | // files (the "Software"), to deal in the Software without 11 | // restriction, including without limitation the rights to use, 12 | // copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | // copies of the Software, and to permit persons to whom the 14 | // Software is furnished to do so, subject to the following 15 | // conditions: 16 | // 17 | // The above copyright notice and this permission notice shall be 18 | // included in all copies or substantial portions of the Software. 19 | // 20 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 21 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 22 | // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 23 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 24 | // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 25 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 26 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 27 | // OTHER DEALINGS IN THE SOFTWARE. 28 | // 29 | 30 | #import "NSDictionary_JSONExtensions.h" 31 | 32 | #import "CJSONDeserializer.h" 33 | 34 | @implementation NSDictionary (NSDictionary_JSONExtensions) 35 | 36 | + (id)dictionaryWithJSONData:(NSData *)inData error:(NSError **)outError 37 | { 38 | return([[CJSONDeserializer deserializer] deserialize:inData error:outError]); 39 | } 40 | 41 | + (id)dictionaryWithJSONString:(NSString *)inJSON error:(NSError **)outError; 42 | { 43 | NSData *theData = [inJSON dataUsingEncoding:NSUTF8StringEncoding]; 44 | return([self dictionaryWithJSONData:theData error:outError]); 45 | } 46 | 47 | @end 48 | -------------------------------------------------------------------------------- /CocoParticle/libs/TouchJSON/JSON/CJSONDeserializer.h: -------------------------------------------------------------------------------- 1 | // 2 | // CJSONDeserializer.h 3 | // TouchCode 4 | // 5 | // Created by Jonathan Wight on 12/15/2005. 6 | // Copyright 2005 toxicsoftware.com. All rights reserved. 7 | // 8 | // Permission is hereby granted, free of charge, to any person 9 | // obtaining a copy of this software and associated documentation 10 | // files (the "Software"), to deal in the Software without 11 | // restriction, including without limitation the rights to use, 12 | // copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | // copies of the Software, and to permit persons to whom the 14 | // Software is furnished to do so, subject to the following 15 | // conditions: 16 | // 17 | // The above copyright notice and this permission notice shall be 18 | // included in all copies or substantial portions of the Software. 19 | // 20 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 21 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 22 | // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 23 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 24 | // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 25 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 26 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 27 | // OTHER DEALINGS IN THE SOFTWARE. 28 | // 29 | 30 | #import 31 | 32 | #import "CJSONScanner.h" 33 | 34 | extern NSString *const kJSONDeserializerErrorDomain /* = @"CJSONDeserializerErrorDomain" */; 35 | 36 | enum { 37 | kJSONDeserializationOptions_MutableContainers = kJSONScannerOptions_MutableContainers, 38 | kJSONDeserializationOptions_MutableLeaves = kJSONScannerOptions_MutableLeaves, 39 | }; 40 | typedef NSUInteger EJSONDeserializationOptions; 41 | 42 | @class CJSONScanner; 43 | 44 | @interface CJSONDeserializer : NSObject { 45 | CJSONScanner *scanner; 46 | EJSONDeserializationOptions options; 47 | } 48 | 49 | @property (readwrite, nonatomic, retain) CJSONScanner *scanner; 50 | /// Object to return instead when a null encountered in the JSON. Defaults to NSNull. Setting to null causes the scanner to skip null values. 51 | @property (readwrite, nonatomic, retain) id nullObject; 52 | /// JSON must be encoded in Unicode (UTF-8, UTF-16 or UTF-32). Use this if you expect to get the JSON in another encoding. 53 | @property (readwrite, nonatomic, assign) NSStringEncoding allowedEncoding; 54 | @property (readwrite, nonatomic, assign) EJSONDeserializationOptions options; 55 | 56 | + (id)deserializer; 57 | 58 | - (id)deserialize:(NSData *)inData error:(NSError **)outError; 59 | 60 | - (id)deserializeAsDictionary:(NSData *)inData error:(NSError **)outError; 61 | - (id)deserializeAsArray:(NSData *)inData error:(NSError **)outError; 62 | 63 | @end 64 | -------------------------------------------------------------------------------- /CocoParticle/libs/TouchJSON/JSON/CJSONSerializer.h: -------------------------------------------------------------------------------- 1 | // 2 | // CJSONSerializer.h 3 | // TouchCode 4 | // 5 | // Created by Jonathan Wight on 12/07/2005. 6 | // Copyright 2005 toxicsoftware.com. All rights reserved. 7 | // 8 | // Permission is hereby granted, free of charge, to any person 9 | // obtaining a copy of this software and associated documentation 10 | // files (the "Software"), to deal in the Software without 11 | // restriction, including without limitation the rights to use, 12 | // copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | // copies of the Software, and to permit persons to whom the 14 | // Software is furnished to do so, subject to the following 15 | // conditions: 16 | // 17 | // The above copyright notice and this permission notice shall be 18 | // included in all copies or substantial portions of the Software. 19 | // 20 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 21 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 22 | // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 23 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 24 | // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 25 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 26 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 27 | // OTHER DEALINGS IN THE SOFTWARE. 28 | // 29 | 30 | #import 31 | 32 | @interface CJSONSerializer : NSObject { 33 | } 34 | 35 | + (id)serializer; 36 | 37 | - (BOOL)isValidJSONObject:(id)inObject; 38 | 39 | /// Take any JSON compatible object (generally NSNull, NSNumber, NSString, NSArray and NSDictionary) and produce an NSData containing the serialized JSON. 40 | - (NSData *)serializeObject:(id)inObject error:(NSError **)outError; 41 | 42 | - (NSData *)serializeNull:(NSNull *)inNull error:(NSError **)outError; 43 | - (NSData *)serializeNumber:(NSNumber *)inNumber error:(NSError **)outError; 44 | - (NSData *)serializeString:(NSString *)inString error:(NSError **)outError; 45 | - (NSData *)serializeArray:(NSArray *)inArray error:(NSError **)outError; 46 | - (NSData *)serializeDictionary:(NSDictionary *)inDictionary error:(NSError **)outError; 47 | 48 | @end 49 | 50 | typedef enum { 51 | CJSONSerializerErrorCouldNotSerializeDataType = -1, 52 | CJSONSerializerErrorCouldNotSerializeObject = -1 53 | } CJSONSerializerError; 54 | -------------------------------------------------------------------------------- /CocoParticle/libs/TouchJSON/JSON/JSONRepresentation.h: -------------------------------------------------------------------------------- 1 | // 2 | // JSONRepresentation.h 3 | // TouchJSON 4 | // 5 | // Created by Jonathan Wight on 10/15/10. 6 | // Copyright 2010 toxicsoftware.com. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @protocol JSONRepresentation 12 | 13 | @optional 14 | - (id)initWithJSONDataRepresentation:(NSData *)inJSONData; 15 | 16 | - (NSData *)JSONDataRepresentation; 17 | 18 | @end 19 | -------------------------------------------------------------------------------- /CocoParticle/libs/cocos2d/CCActionCamera.h: -------------------------------------------------------------------------------- 1 | /* 2 | * cocos2d for iPhone: http://www.cocos2d-iphone.org 3 | * 4 | * Copyright (c) 2008-2010 Ricardo Quesada 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in 14 | * all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | * THE SOFTWARE. 23 | * 24 | */ 25 | 26 | #import "CCActionInterval.h" 27 | 28 | @class CCCamera; 29 | 30 | /** Base class for CCCamera actions 31 | */ 32 | @interface CCActionCamera : CCActionInterval 33 | { 34 | float centerXOrig_; 35 | float centerYOrig_; 36 | float centerZOrig_; 37 | 38 | float eyeXOrig_; 39 | float eyeYOrig_; 40 | float eyeZOrig_; 41 | 42 | float upXOrig_; 43 | float upYOrig_; 44 | float upZOrig_; 45 | } 46 | @end 47 | 48 | /** CCOrbitCamera action 49 | Orbits the camera around the center of the screen using spherical coordinates 50 | */ 51 | @interface CCOrbitCamera : CCActionCamera 52 | { 53 | float radius_; 54 | float deltaRadius_; 55 | float angleZ_; 56 | float deltaAngleZ_; 57 | float angleX_; 58 | float deltaAngleX_; 59 | 60 | float radZ_; 61 | float radDeltaZ_; 62 | float radX_; 63 | float radDeltaX_; 64 | 65 | } 66 | /** creates a CCOrbitCamera action with radius, delta-radius, z, deltaZ, x, deltaX */ 67 | +(id) actionWithDuration:(float) t radius:(float)r deltaRadius:(float) dr angleZ:(float)z deltaAngleZ:(float)dz angleX:(float)x deltaAngleX:(float)dx; 68 | /** initializes a CCOrbitCamera action with radius, delta-radius, z, deltaZ, x, deltaX */ 69 | -(id) initWithDuration:(float) t radius:(float)r deltaRadius:(float) dr angleZ:(float)z deltaAngleZ:(float)dz angleX:(float)x deltaAngleX:(float)dx; 70 | /** positions the camera according to spherical coordinates */ 71 | -(void) sphericalRadius:(float*) r zenith:(float*) zenith azimuth:(float*) azimuth; 72 | @end 73 | -------------------------------------------------------------------------------- /CocoParticle/libs/cocos2d/CCActionPageTurn3D.h: -------------------------------------------------------------------------------- 1 | /* 2 | * cocos2d for iPhone: http://www.cocos2d-iphone.org 3 | * 4 | * Copyright (c) 2009 Sindesso Pty Ltd http://www.sindesso.com/ 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in 14 | * all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | * THE SOFTWARE. 23 | * 24 | */ 25 | 26 | 27 | #import "CCActionGrid3D.h" 28 | 29 | /** 30 | * This action simulates a page turn from the bottom right hand corner of the screen 31 | * It's not much use by itself but is used by the PageTurnTransition. 32 | * 33 | * Based on an original paper by L Hong et al. 34 | * http://www.parc.com/publication/1638/turning-pages-of-3d-electronic-books.html 35 | * 36 | * @since v0.8.2 37 | */ 38 | @interface CCPageTurn3D : CCGrid3DAction 39 | { 40 | } 41 | 42 | @end 43 | -------------------------------------------------------------------------------- /CocoParticle/libs/cocos2d/CCActionPageTurn3D.m: -------------------------------------------------------------------------------- 1 | /* 2 | * cocos2d for iPhone: http://www.cocos2d-iphone.org 3 | * 4 | * Copyright (c) 2009 Sindesso Pty Ltd http://www.sindesso.com/ 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in 14 | * all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | * THE SOFTWARE. 23 | * 24 | */ 25 | 26 | #import "CCActionPageTurn3D.h" 27 | 28 | @implementation CCPageTurn3D 29 | 30 | /* 31 | * Update each tick 32 | * Time is the percentage of the way through the duration 33 | */ 34 | -(void)update:(ccTime)time 35 | { 36 | float tt = MAX( 0, time - 0.25f ); 37 | float deltaAy = ( tt * tt * 500); 38 | float ay = -100 - deltaAy; 39 | 40 | float deltaTheta = - (float) M_PI_2 * sqrtf( time) ; 41 | float theta = /*0.01f*/ + (float) M_PI_2 +deltaTheta; 42 | 43 | float sinTheta = sinf(theta); 44 | float cosTheta = cosf(theta); 45 | 46 | for( int i = 0; i <=gridSize_.x; i++ ) 47 | { 48 | for( int j = 0; j <= gridSize_.y; j++ ) 49 | { 50 | // Get original vertex 51 | ccVertex3F p = [self originalVertex:ccg(i,j)]; 52 | 53 | float R = sqrtf(p.x*p.x + (p.y - ay) * (p.y - ay)); 54 | float r = R * sinTheta; 55 | float alpha = asinf( p.x / R ); 56 | float beta = alpha / sinTheta; 57 | float cosBeta = cosf( beta ); 58 | 59 | // If beta > PI then we've wrapped around the cone 60 | // Reduce the radius to stop these points interfering with others 61 | if( beta <= M_PI) 62 | p.x = ( r * sinf(beta)); 63 | else 64 | { 65 | // Force X = 0 to stop wrapped 66 | // points 67 | p.x = 0; 68 | } 69 | 70 | p.y = ( R + ay - ( r*(1 - cosBeta)*sinTheta)); 71 | 72 | // We scale z here to avoid the animation being 73 | // too much bigger than the screen due to perspectve transform 74 | p.z = (r * ( 1 - cosBeta ) * cosTheta) / 7; // "100" didn't work for 75 | 76 | // Stop z coord from dropping beneath underlying page in a transition 77 | // issue #751 78 | if( p.z<0.5f ) 79 | p.z = 0.5f; 80 | 81 | // Set new coords 82 | [self setVertex:ccg(i,j) vertex:p]; 83 | } 84 | } 85 | } 86 | @end 87 | -------------------------------------------------------------------------------- /CocoParticle/libs/cocos2d/CCActionProgressTimer.h: -------------------------------------------------------------------------------- 1 | /* 2 | * cocos2d for iPhone: http://www.cocos2d-iphone.org 3 | * 4 | * Copyright (C) 2010 Lam Pham 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in 14 | * all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | * THE SOFTWARE. 23 | * 24 | */ 25 | 26 | 27 | #import 28 | #import "CCProgressTimer.h" 29 | #import "CCActionInterval.h" 30 | 31 | /** 32 | Progress to percentage 33 | @since v0.99.1 34 | */ 35 | @interface CCProgressTo : CCActionInterval 36 | { 37 | float to_; 38 | float from_; 39 | } 40 | /** Creates and initializes with a duration and a percent */ 41 | +(id) actionWithDuration:(ccTime)duration percent:(float)percent; 42 | /** Initializes with a duration and a percent */ 43 | -(id) initWithDuration:(ccTime)duration percent:(float)percent; 44 | @end 45 | 46 | /** 47 | Progress from a percentage to another percentage 48 | @since v0.99.1 49 | */ 50 | @interface CCProgressFromTo : CCActionInterval 51 | { 52 | float to_; 53 | float from_; 54 | } 55 | /** Creates and initializes the action with a duration, a "from" percentage and a "to" percentage */ 56 | +(id) actionWithDuration:(ccTime)duration from:(float)fromPercentage to:(float) toPercentage; 57 | /** Initializes the action with a duration, a "from" percentage and a "to" percentage */ 58 | -(id) initWithDuration:(ccTime)duration from:(float)fromPercentage to:(float) toPercentage; 59 | @end 60 | -------------------------------------------------------------------------------- /CocoParticle/libs/cocos2d/CCActionTween.h: -------------------------------------------------------------------------------- 1 | /* 2 | * cocos2d for iPhone: http://www.cocos2d-iphone.org 3 | * 4 | * Copyright 2009 lhunath (Maarten Billemont) 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in 14 | * all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | * THE SOFTWARE. 23 | * 24 | */ 25 | 26 | 27 | #import 28 | #import "CCActionInterval.h" 29 | 30 | /** CCActionTween 31 | 32 | CCActionTween is an action that lets you update any property of an object. 33 | For example, if you want to modify the "width" property of a target from 200 to 300 in 2 senconds, then: 34 | 35 | id modifyWidth = [CCActionTween actionWithDuration:2 key:@"width" from:200 to:300]; 36 | [target runAction:modifyWidth]; 37 | 38 | 39 | Another example: CCScaleTo action could be rewriten using CCPropertyAction: 40 | 41 | // scaleA and scaleB are equivalents 42 | id scaleA = [CCScaleTo actionWithDuration:2 scale:3]; 43 | id scaleB = [CCActionTween actionWithDuration:2 key:@"scale" from:1 to:3]; 44 | 45 | 46 | @since v0.99.2 47 | */ 48 | @interface CCActionTween : CCActionInterval 49 | { 50 | NSString *key_; 51 | 52 | float from_, to_; 53 | float delta_; 54 | } 55 | 56 | /** creates an initializes the action with the property name (key), and the from and to parameters. */ 57 | + (id)actionWithDuration:(ccTime)aDuration key:(NSString *)key from:(float)from to:(float)to; 58 | 59 | /** initializes the action with the property name (key), and the from and to parameters. */ 60 | - (id)initWithDuration:(ccTime)aDuration key:(NSString *)key from:(float)from to:(float)to; 61 | 62 | @end 63 | -------------------------------------------------------------------------------- /CocoParticle/libs/cocos2d/CCActionTween.m: -------------------------------------------------------------------------------- 1 | /* 2 | * cocos2d for iPhone: http://www.cocos2d-iphone.org 3 | * 4 | * Copyright 2009 lhunath (Maarten Billemont) 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in 14 | * all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | * THE SOFTWARE. 23 | * 24 | */ 25 | 26 | #import "CCActionTween.h" 27 | 28 | 29 | @implementation CCActionTween 30 | 31 | + (id)actionWithDuration:(ccTime)aDuration key:(NSString *)aKey from:(float)aFrom to:(float)aTo { 32 | 33 | return [[[[self class] alloc] initWithDuration:aDuration key:aKey from:aFrom to:aTo] autorelease]; 34 | } 35 | 36 | - (id)initWithDuration:(ccTime)aDuration key:(NSString *)key from:(float)from to:(float)to { 37 | 38 | if ((self = [super initWithDuration:aDuration])) { 39 | 40 | key_ = [key copy]; 41 | to_ = to; 42 | from_ = from; 43 | 44 | } 45 | 46 | return self; 47 | } 48 | 49 | - (void) dealloc 50 | { 51 | [key_ release]; 52 | [super dealloc]; 53 | } 54 | 55 | - (void)startWithTarget:aTarget 56 | { 57 | [super startWithTarget:aTarget]; 58 | delta_ = to_ - from_; 59 | } 60 | 61 | - (void) update:(ccTime) dt 62 | { 63 | [target_ setValue:[NSNumber numberWithFloat:to_ - delta_ * (1 - dt)] forKey:key_]; 64 | } 65 | 66 | - (CCActionInterval *) reverse 67 | { 68 | return [[self class] actionWithDuration:duration_ key:key_ from:to_ to:from_]; 69 | } 70 | 71 | 72 | @end 73 | -------------------------------------------------------------------------------- /CocoParticle/libs/cocos2d/CCAnimationCache.h: -------------------------------------------------------------------------------- 1 | /* 2 | * cocos2d for iPhone: http://www.cocos2d-iphone.org 3 | * 4 | * Copyright (c) 2010 Ricardo Quesada 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in 14 | * all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | * THE SOFTWARE. 23 | * 24 | */ 25 | 26 | #import 27 | 28 | @class CCAnimation; 29 | 30 | /** Singleton that manages the Animations. 31 | It saves in a cache the animations. You should use this class if you want to save your animations in a cache. 32 | 33 | Before v0.99.5, the recommend way was to save them on the CCSprite. Since v0.99.5, you should use this class instead. 34 | 35 | @since v0.99.5 36 | */ 37 | @interface CCAnimationCache : NSObject 38 | { 39 | NSMutableDictionary *animations_; 40 | } 41 | 42 | /** Retruns ths shared instance of the Animation cache */ 43 | + (CCAnimationCache *) sharedAnimationCache; 44 | 45 | /** Purges the cache. It releases all the CCAnimation objects and the shared instance. 46 | */ 47 | +(void)purgeSharedAnimationCache; 48 | 49 | /** Adds a CCAnimation with a name. 50 | */ 51 | -(void) addAnimation:(CCAnimation*)animation name:(NSString*)name; 52 | 53 | /** Deletes a CCAnimation from the cache. 54 | */ 55 | -(void) removeAnimationByName:(NSString*)name; 56 | 57 | /** Returns a CCAnimation that was previously added. 58 | If the name is not found it will return nil. 59 | You should retain the returned copy if you are going to use it. 60 | */ 61 | -(CCAnimation*) animationByName:(NSString*)name; 62 | 63 | @end 64 | -------------------------------------------------------------------------------- /CocoParticle/libs/cocos2d/CCAnimationCache.m: -------------------------------------------------------------------------------- 1 | /* 2 | * cocos2d for iPhone: http://www.cocos2d-iphone.org 3 | * 4 | * Copyright (c) 2010 Ricardo Quesada 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in 14 | * all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | * THE SOFTWARE. 23 | * 24 | */ 25 | 26 | #import "ccMacros.h" 27 | #import "CCAnimationCache.h" 28 | #import "CCAnimation.h" 29 | #import "CCSprite.h" 30 | 31 | 32 | @implementation CCAnimationCache 33 | 34 | #pragma mark CCAnimationCache - Alloc, Init & Dealloc 35 | 36 | static CCAnimationCache *sharedAnimationCache_=nil; 37 | 38 | + (CCAnimationCache *)sharedAnimationCache 39 | { 40 | if (!sharedAnimationCache_) 41 | sharedAnimationCache_ = [[CCAnimationCache alloc] init]; 42 | 43 | return sharedAnimationCache_; 44 | } 45 | 46 | +(id)alloc 47 | { 48 | NSAssert(sharedAnimationCache_ == nil, @"Attempted to allocate a second instance of a singleton."); 49 | return [super alloc]; 50 | } 51 | 52 | +(void)purgeSharedAnimationCache 53 | { 54 | [sharedAnimationCache_ release]; 55 | sharedAnimationCache_ = nil; 56 | } 57 | 58 | -(id) init 59 | { 60 | if( (self=[super init]) ) { 61 | animations_ = [[NSMutableDictionary alloc] initWithCapacity: 20]; 62 | } 63 | 64 | return self; 65 | } 66 | 67 | - (NSString*) description 68 | { 69 | return [NSString stringWithFormat:@"<%@ = %08X | num of animations = %i>", [self class], self, [animations_ count]]; 70 | } 71 | 72 | -(void) dealloc 73 | { 74 | CCLOGINFO(@"cocos2d: deallocing %@", self); 75 | 76 | [animations_ release]; 77 | [super dealloc]; 78 | } 79 | 80 | #pragma mark CCAnimationCache - load/get/del 81 | 82 | -(void) addAnimation:(CCAnimation*)animation name:(NSString*)name 83 | { 84 | [animations_ setObject:animation forKey:name]; 85 | } 86 | 87 | -(void) removeAnimationByName:(NSString*)name 88 | { 89 | if( ! name ) 90 | return; 91 | 92 | [animations_ removeObjectForKey:name]; 93 | } 94 | 95 | -(CCAnimation*) animationByName:(NSString*)name 96 | { 97 | return [animations_ objectForKey:name]; 98 | } 99 | 100 | @end 101 | -------------------------------------------------------------------------------- /CocoParticle/libs/cocos2d/CCBlockSupport.h: -------------------------------------------------------------------------------- 1 | /* 2 | * cocos2d for iPhone: http://www.cocos2d-iphone.org 3 | * 4 | * Copyright (c) 2010 Stuart Carnie 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in 14 | * all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | * THE SOFTWARE. 23 | * 24 | */ 25 | 26 | 27 | #import 28 | 29 | /** @file 30 | cocos2d blocks support 31 | */ 32 | 33 | // To comply with Apple Objective C runtime (this is defined in NSObjCRuntime.h) 34 | #if !defined(NS_BLOCKS_AVAILABLE) 35 | #if __BLOCKS__ 36 | #define NS_BLOCKS_AVAILABLE 1 37 | #else 38 | #define NS_BLOCKS_AVAILABLE 0 39 | #endif 40 | #endif 41 | 42 | #if NS_BLOCKS_AVAILABLE 43 | 44 | @interface NSObject(CCBlocksAdditions) 45 | 46 | - (void)ccCallbackBlock; 47 | - (void)ccCallbackBlockWithSender:(id)sender; 48 | 49 | @end 50 | 51 | #endif // NS_BLOCKS_AVAILABLE 52 | -------------------------------------------------------------------------------- /CocoParticle/libs/cocos2d/CCBlockSupport.m: -------------------------------------------------------------------------------- 1 | /* 2 | * cocos2d for iPhone: http://www.cocos2d-iphone.org 3 | * 4 | * Copyright (c) 2010 Stuart Carnie 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in 14 | * all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | * THE SOFTWARE. 23 | * 24 | */ 25 | 26 | 27 | #import "CCBlockSupport.h" 28 | 29 | #if NS_BLOCKS_AVAILABLE 30 | 31 | @implementation NSObject(CCBlocksAdditions) 32 | 33 | - (void)ccCallbackBlock { 34 | void (^block)(void) = (id)self; 35 | block(); 36 | } 37 | 38 | - (void)ccCallbackBlockWithSender:(id)sender { 39 | void (^block)(id) = (id)self; 40 | block(sender); 41 | } 42 | 43 | 44 | @end 45 | 46 | #endif 47 | -------------------------------------------------------------------------------- /CocoParticle/libs/cocos2d/CCGrabber.h: -------------------------------------------------------------------------------- 1 | /* 2 | * cocos2d for iPhone: http://www.cocos2d-iphone.org 3 | * 4 | * Copyright (c) 2009 On-Core 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in 14 | * all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | * THE SOFTWARE. 23 | * 24 | */ 25 | 26 | 27 | #import "Platforms/CCGL.h" 28 | #import 29 | 30 | @class CCTexture2D; 31 | 32 | /** FBO class that grabs the the contents of the screen */ 33 | @interface CCGrabber : NSObject 34 | { 35 | GLuint fbo; 36 | GLint oldFBO; 37 | } 38 | 39 | -(void)grab:(CCTexture2D*)texture; 40 | -(void)beforeRender:(CCTexture2D*)texture; 41 | -(void)afterRender:(CCTexture2D*)texture; 42 | 43 | @end 44 | -------------------------------------------------------------------------------- /CocoParticle/libs/cocos2d/CCGrabber.m: -------------------------------------------------------------------------------- 1 | /* 2 | * cocos2d for iPhone: http://www.cocos2d-iphone.org 3 | * 4 | * Copyright (c) 2009 On-Core 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in 14 | * all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | * THE SOFTWARE. 23 | * 24 | */ 25 | 26 | 27 | #import "Platforms/CCGL.h" 28 | #import "CCGrabber.h" 29 | #import "ccMacros.h" 30 | #import "CCTexture2D.h" 31 | #import "Support/OpenGL_Internal.h" 32 | 33 | @implementation CCGrabber 34 | 35 | -(id) init 36 | { 37 | if(( self = [super init] )) { 38 | // generate FBO 39 | ccglGenFramebuffers(1, &fbo); 40 | } 41 | return self; 42 | } 43 | 44 | -(void)grab:(CCTexture2D*)texture 45 | { 46 | glGetIntegerv(CC_GL_FRAMEBUFFER_BINDING, &oldFBO); 47 | 48 | // bind 49 | ccglBindFramebuffer(CC_GL_FRAMEBUFFER, fbo); 50 | 51 | // associate texture with FBO 52 | ccglFramebufferTexture2D(CC_GL_FRAMEBUFFER, CC_GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, texture.name, 0); 53 | 54 | // check if it worked (probably worth doing :) ) 55 | GLuint status = ccglCheckFramebufferStatus(CC_GL_FRAMEBUFFER); 56 | if (status != CC_GL_FRAMEBUFFER_COMPLETE) 57 | [NSException raise:@"Frame Grabber" format:@"Could not attach texture to framebuffer"]; 58 | 59 | ccglBindFramebuffer(CC_GL_FRAMEBUFFER, oldFBO); 60 | } 61 | 62 | -(void)beforeRender:(CCTexture2D*)texture 63 | { 64 | glGetIntegerv(CC_GL_FRAMEBUFFER_BINDING, &oldFBO); 65 | ccglBindFramebuffer(CC_GL_FRAMEBUFFER, fbo); 66 | 67 | // BUG XXX: doesn't work with RGB565. 68 | 69 | 70 | glClearColor(0,0,0,0); 71 | 72 | // BUG #631: To fix #631, uncomment the lines with #631 73 | // Warning: But it CCGrabber won't work with 2 effects at the same time 74 | // glClearColor(0.0f,0.0f,0.0f,1.0f); // #631 75 | 76 | glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); 77 | 78 | // glColorMask(TRUE, TRUE, TRUE, FALSE); // #631 79 | 80 | } 81 | 82 | -(void)afterRender:(CCTexture2D*)texture 83 | { 84 | ccglBindFramebuffer(CC_GL_FRAMEBUFFER, oldFBO); 85 | // glColorMask(TRUE, TRUE, TRUE, TRUE); // #631 86 | } 87 | 88 | - (void) dealloc 89 | { 90 | CCLOGINFO(@"cocos2d: deallocing %@", self); 91 | ccglDeleteFramebuffers(1, &fbo); 92 | [super dealloc]; 93 | } 94 | 95 | @end 96 | -------------------------------------------------------------------------------- /CocoParticle/libs/cocos2d/CCLabelAtlas.h: -------------------------------------------------------------------------------- 1 | /* 2 | * cocos2d for iPhone: http://www.cocos2d-iphone.org 3 | * 4 | * Copyright (c) 2008-2010 Ricardo Quesada 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in 14 | * all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | * THE SOFTWARE. 23 | * 24 | */ 25 | 26 | 27 | #import "CCAtlasNode.h" 28 | #import "CCTextureAtlas.h" 29 | 30 | /** CCLabelAtlas is a subclass of CCAtlasNode. 31 | 32 | It can be as a replacement of CCLabel since it is MUCH faster. 33 | 34 | CCLabelAtlas versus CCLabel: 35 | - CCLabelAtlas is MUCH faster than CCLabel 36 | - CCLabelAtlas "characters" have a fixed height and width 37 | - CCLabelAtlas "characters" can be anything you want since they are taken from an image file 38 | 39 | A more flexible class is CCBitmapFontAtlas. It supports variable width characters and it also has a nice editor. 40 | */ 41 | @interface CCLabelAtlas : CCAtlasNode 42 | { 43 | // string to render 44 | NSString *string_; 45 | 46 | // the first char in the charmap 47 | char mapStartChar; 48 | } 49 | 50 | 51 | /** creates the CCLabelAtlas with a string, a char map file(the atlas), the width and height of each element in points and the starting char of the atlas */ 52 | +(id) labelWithString:(NSString*) string charMapFile: (NSString*) charmapfile itemWidth:(int)w itemHeight:(int)h startCharMap:(char)c; 53 | 54 | /** creates the CCLabelAtlas with a string, a char map file(the atlas), the width and height of each element in points and the starting char of the atlas. 55 | @deprecated Will be removed in 1.0.1. Use "labelWithString:" instead 56 | */ 57 | +(id) labelAtlasWithString:(NSString*) string charMapFile: (NSString*) charmapfile itemWidth:(int)w itemHeight:(int)h startCharMap:(char)c DEPRECATED_ATTRIBUTE; 58 | 59 | /** initializes the CCLabelAtlas with a string, a char map file(the atlas), the width and height in points of each element and the starting char of the atlas */ 60 | -(id) initWithString:(NSString*) string charMapFile: (NSString*) charmapfile itemWidth:(int)w itemHeight:(int)h startCharMap:(char)c; 61 | @end 62 | -------------------------------------------------------------------------------- /CocoParticle/libs/cocos2d/CCLabelTTF.h: -------------------------------------------------------------------------------- 1 | /* 2 | * cocos2d for iPhone: http://www.cocos2d-iphone.org 3 | * 4 | * Copyright (c) 2008-2010 Ricardo Quesada 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in 14 | * all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | * THE SOFTWARE. 23 | * 24 | */ 25 | 26 | 27 | #import "CCTexture2D.h" 28 | #import "CCSprite.h" 29 | #import "Platforms/CCNS.h" 30 | 31 | 32 | /** CCLabel is a subclass of CCTextureNode that knows how to render text labels 33 | * 34 | * All features from CCTextureNode are valid in CCLabel 35 | * 36 | * CCLabel objects are slow. Consider using CCLabelAtlas or CCBitmapFontAtlas instead. 37 | */ 38 | 39 | @interface CCLabelTTF : CCSprite 40 | { 41 | CGSize dimensions_; 42 | CCTextAlignment alignment_; 43 | NSString * fontName_; 44 | CGFloat fontSize_; 45 | NSString *string_; 46 | } 47 | 48 | /** creates a CCLabel from a fontname, alignment, dimension in points and font size in points*/ 49 | + (id) labelWithString:(NSString*)string dimensions:(CGSize)dimensions alignment:(CCTextAlignment)alignment fontName:(NSString*)name fontSize:(CGFloat)size; 50 | /** creates a CCLabel from a fontname and font size in points*/ 51 | + (id) labelWithString:(NSString*)string fontName:(NSString*)name fontSize:(CGFloat)size; 52 | /** initializes the CCLabel with a font name, alignment, dimension in points and font size in points */ 53 | - (id) initWithString:(NSString*)string dimensions:(CGSize)dimensions alignment:(CCTextAlignment)alignment fontName:(NSString*)name fontSize:(CGFloat)size; 54 | /** initializes the CCLabel with a font name and font size in points */ 55 | - (id) initWithString:(NSString*)string fontName:(NSString*)name fontSize:(CGFloat)size; 56 | 57 | /** changes the string to render 58 | * @warning Changing the string is as expensive as creating a new CCLabel. To obtain better performance use CCLabelAtlas 59 | */ 60 | - (void) setString:(NSString*)str; 61 | 62 | @end 63 | -------------------------------------------------------------------------------- /CocoParticle/libs/cocos2d/CCMotionStreak.h: -------------------------------------------------------------------------------- 1 | /* 2 | * cocos2d for iPhone: http://www.cocos2d-iphone.org 3 | * 4 | * Copyright (c) 2008, 2009 Jason Booth 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in 14 | * all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | * THE SOFTWARE. 23 | * 24 | */ 25 | 26 | #import 27 | #import "CCNode.h" 28 | #import "CCRibbon.h" 29 | 30 | /** 31 | * CCMotionStreak manages a Ribbon based on it's motion in absolute space. 32 | * You construct it with a fadeTime, minimum segment size, texture path, texture 33 | * length and color. The fadeTime controls how long it takes each vertex in 34 | * the streak to fade out, the minimum segment size it how many pixels the 35 | * streak will move before adding a new ribbon segement, and the texture 36 | * length is the how many pixels the texture is stretched across. The texture 37 | * is vertically aligned along the streak segemnts. 38 | * 39 | * Limitations: 40 | * CCMotionStreak, by default, will use the GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA blending function. 41 | * This blending function might not be the correct one for certain textures. 42 | * But you can change it by using: 43 | * [obj setBlendFunc: (ccBlendfunc) {new_src_blend_func, new_dst_blend_func}]; 44 | * 45 | * @since v0.8.1 46 | */ 47 | @interface CCMotionStreak : CCNode 48 | { 49 | CCRibbon* ribbon_; 50 | float segThreshold_; 51 | float width_; 52 | CGPoint lastLocation_; 53 | } 54 | 55 | /** Ribbon used by MotionStreak (weak reference) */ 56 | @property (nonatomic,readonly) CCRibbon *ribbon; 57 | 58 | /** creates the a MotionStreak. The image will be loaded using the TextureMgr. */ 59 | +(id)streakWithFade:(float)fade minSeg:(float)seg image:(NSString*)path width:(float)width length:(float)length color:(ccColor4B)color; 60 | 61 | /** initializes a MotionStreak. The file will be loaded using the TextureMgr. */ 62 | -(id)initWithFade:(float)fade minSeg:(float)seg image:(NSString*)path width:(float)width length:(float)length color:(ccColor4B)color; 63 | 64 | /** polling function */ 65 | -(void)update:(ccTime)delta; 66 | 67 | @end 68 | -------------------------------------------------------------------------------- /CocoParticle/libs/cocos2d/CCParallaxNode.h: -------------------------------------------------------------------------------- 1 | /* 2 | * cocos2d for iPhone: http://www.cocos2d-iphone.org 3 | * 4 | * Copyright (c) 2009-2010 Ricardo Quesada 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in 14 | * all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | * THE SOFTWARE. 23 | * 24 | */ 25 | 26 | #import "CCNode.h" 27 | #import "Support/ccCArray.h" 28 | 29 | /** CCParallaxNode: A node that simulates a parallax scroller 30 | 31 | The children will be moved faster / slower than the parent according the the parallax ratio. 32 | 33 | */ 34 | @interface CCParallaxNode : CCNode 35 | { 36 | ccArray *parallaxArray_; 37 | CGPoint lastPosition; 38 | } 39 | 40 | /** array that holds the offset / ratio of the children */ 41 | @property (nonatomic,readwrite) ccArray * parallaxArray; 42 | 43 | /** Adds a child to the container with a z-order, a parallax ratio and a position offset 44 | It returns self, so you can chain several addChilds. 45 | @since v0.8 46 | */ 47 | -(void) addChild: (CCNode*)node z:(NSInteger)z parallaxRatio:(CGPoint)c positionOffset:(CGPoint)positionOffset; 48 | 49 | @end 50 | -------------------------------------------------------------------------------- /CocoParticle/libs/cocos2d/CCParticleSystemPoint.h: -------------------------------------------------------------------------------- 1 | /* 2 | * cocos2d for iPhone: http://www.cocos2d-iphone.org 3 | * 4 | * Copyright (c) 2008-2010 Ricardo Quesada 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in 14 | * all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | * THE SOFTWARE. 23 | * 24 | */ 25 | 26 | 27 | #import 28 | #import "CCParticleSystem.h" 29 | 30 | #define CC_MAX_PARTICLE_SIZE 64 31 | 32 | #ifdef __IPHONE_OS_VERSION_MAX_ALLOWED 33 | 34 | /** CCParticleSystemPoint is a subclass of CCParticleSystem 35 | Attributes of a Particle System: 36 | * All the attributes of Particle System 37 | 38 | Features: 39 | * consumes small memory: uses 1 vertex (x,y) per particle, no need to assign tex coordinates 40 | * size can't be bigger than 64 41 | * the system can't be scaled since the particles are rendered using GL_POINT_SPRITE 42 | 43 | Limitations: 44 | * On 3rd gen iPhone devices and iPads, this node performs MUCH slower than CCParticleSystemQuad. 45 | */ 46 | @interface CCParticleSystemPoint : CCParticleSystem 47 | { 48 | // Array of (x,y,size) 49 | ccPointSprite *vertices; 50 | // vertices buffer id 51 | #if CC_USES_VBO 52 | GLuint verticesID; 53 | #endif 54 | } 55 | @end 56 | 57 | #elif __MAC_OS_X_VERSION_MAX_ALLOWED 58 | 59 | #import "CCParticleSystemQuad.h" 60 | 61 | @interface CCParticleSystemPoint : CCParticleSystemQuad 62 | @end 63 | 64 | #endif 65 | -------------------------------------------------------------------------------- /CocoParticle/libs/cocos2d/CCParticleSystemQuad.h: -------------------------------------------------------------------------------- 1 | /* 2 | * cocos2d for iPhone: http://www.cocos2d-iphone.org 3 | * 4 | * Copyright (c) 2008-2010 Ricardo Quesada 5 | * Copyright (c) 2009 Leonardo Kasperavičius 6 | * 7 | * Permission is hereby granted, free of charge, to any person obtaining a copy 8 | * of this software and associated documentation files (the "Software"), to deal 9 | * in the Software without restriction, including without limitation the rights 10 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the Software is 12 | * furnished to do so, subject to the following conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be included in 15 | * all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23 | * THE SOFTWARE. 24 | * 25 | */ 26 | 27 | 28 | #import "CCParticleSystem.h" 29 | #import "ccConfig.h" 30 | 31 | @class CCSpriteFrame; 32 | 33 | /** CCParticleSystemQuad is a subclass of CCParticleSystem 34 | 35 | It includes all the features of ParticleSystem. 36 | 37 | Special features and Limitations: 38 | - Particle size can be any float number. 39 | - The system can be scaled 40 | - The particles can be rotated 41 | - On 1st and 2nd gen iPhones: It is only a bit slower that CCParticleSystemPoint 42 | - On 3rd gen iPhone and iPads: It is MUCH faster than CCParticleSystemPoint 43 | - It consumes more RAM and more GPU memory than CCParticleSystemPoint 44 | - It supports subrects 45 | @since v0.8 46 | */ 47 | @interface CCParticleSystemQuad : CCParticleSystem 48 | { 49 | ccV2F_C4B_T2F_Quad *quads_; // quads to be rendered 50 | GLushort *indices_; // indices 51 | #if CC_USES_VBO 52 | GLuint quadsID_; // VBO id 53 | #endif 54 | } 55 | 56 | /** initialices the indices for the vertices */ 57 | -(void) initIndices; 58 | 59 | /** initilizes the texture with a rectangle measured Points */ 60 | -(void) initTexCoordsWithRect:(CGRect)rect; 61 | 62 | /** Sets a new CCSpriteFrame as particle. 63 | WARNING: this method is experimental. Use setTexture:withRect instead. 64 | @since v0.99.4 65 | */ 66 | -(void)setDisplayFrame:(CCSpriteFrame*)spriteFrame; 67 | 68 | /** Sets a new texture with a rect. The rect is in Points. 69 | @since v0.99.4 70 | */ 71 | -(void) setTexture:(CCTexture2D *)texture withRect:(CGRect)rect; 72 | 73 | @end 74 | 75 | -------------------------------------------------------------------------------- /CocoParticle/libs/cocos2d/CCProgressTimer.h: -------------------------------------------------------------------------------- 1 | /* 2 | * cocos2d for iPhone: http://www.cocos2d-iphone.org 3 | * 4 | * Copyright (c) 2010 Lam Pham 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in 14 | * all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | * THE SOFTWARE. 23 | * 24 | */ 25 | 26 | #import 27 | #import "CCSprite.h" 28 | 29 | /** Types of progress 30 | @since v0.99.1 31 | */ 32 | typedef enum { 33 | /// Radial Counter-Clockwise 34 | kCCProgressTimerTypeRadialCCW, 35 | /// Radial ClockWise 36 | kCCProgressTimerTypeRadialCW, 37 | /// Horizontal Left-Right 38 | kCCProgressTimerTypeHorizontalBarLR, 39 | /// Horizontal Right-Left 40 | kCCProgressTimerTypeHorizontalBarRL, 41 | /// Vertical Bottom-top 42 | kCCProgressTimerTypeVerticalBarBT, 43 | /// Vertical Top-Bottom 44 | kCCProgressTimerTypeVerticalBarTB, 45 | } CCProgressTimerType; 46 | 47 | /** 48 | CCProgresstimer is a subclass of CCNode. 49 | It renders the inner sprite according to the percentage. 50 | The progress can be Radial, Horizontal or vertical. 51 | @since v0.99.1 52 | */ 53 | @interface CCProgressTimer : CCNode 54 | { 55 | CCProgressTimerType type_; 56 | float percentage_; 57 | CCSprite *sprite_; 58 | 59 | int vertexDataCount_; 60 | ccV2F_C4B_T2F *vertexData_; 61 | } 62 | 63 | /** Change the percentage to change progress. */ 64 | @property (nonatomic, readwrite) CCProgressTimerType type; 65 | 66 | /** Percentages are from 0 to 100 */ 67 | @property (nonatomic, readwrite) float percentage; 68 | 69 | /** The image to show the progress percentage */ 70 | @property (nonatomic, readwrite, retain) CCSprite *sprite; 71 | 72 | 73 | /** Creates a progress timer with an image filename as the shape the timer goes through */ 74 | + (id) progressWithFile:(NSString*) filename; 75 | /** Initializes a progress timer with an image filename as the shape the timer goes through */ 76 | - (id) initWithFile:(NSString*) filename; 77 | 78 | /** Creates a progress timer with the texture as the shape the timer goes through */ 79 | + (id) progressWithTexture:(CCTexture2D*) texture; 80 | /** Creates a progress timer with the texture as the shape the timer goes through */ 81 | - (id) initWithTexture:(CCTexture2D*) texture; 82 | 83 | @end 84 | -------------------------------------------------------------------------------- /CocoParticle/libs/cocos2d/CCScene.h: -------------------------------------------------------------------------------- 1 | /* 2 | * cocos2d for iPhone: http://www.cocos2d-iphone.org 3 | * 4 | * Copyright (c) 2008-2010 Ricardo Quesada 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in 14 | * all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | * THE SOFTWARE. 23 | * 24 | */ 25 | 26 | 27 | #import "CCNode.h" 28 | 29 | /** CCScene is a subclass of CCNode that is used only as an abstract concept. 30 | 31 | CCScene an CCNode are almost identical with the difference that CCScene has it's 32 | anchor point (by default) at the center of the screen. 33 | 34 | For the moment CCScene has no other logic than that, but in future releases it might have 35 | additional logic. 36 | 37 | It is a good practice to use and CCScene as the parent of all your nodes. 38 | */ 39 | @interface CCScene : CCNode 40 | { 41 | } 42 | @end 43 | -------------------------------------------------------------------------------- /CocoParticle/libs/cocos2d/CCScene.m: -------------------------------------------------------------------------------- 1 | /* 2 | * cocos2d for iPhone: http://www.cocos2d-iphone.org 3 | * 4 | * Copyright (c) 2008-2010 Ricardo Quesada 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in 14 | * all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | * THE SOFTWARE. 23 | * 24 | */ 25 | 26 | 27 | #import "CCScene.h" 28 | #import "Support/CGPointExtension.h" 29 | #import "CCDirector.h" 30 | 31 | 32 | @implementation CCScene 33 | -(id) init 34 | { 35 | if( (self=[super init]) ) { 36 | CGSize s = [[CCDirector sharedDirector] winSize]; 37 | self.isRelativeAnchorPoint = NO; 38 | anchorPoint_ = ccp(0.5f, 0.5f); 39 | [self setContentSize:s]; 40 | } 41 | 42 | return self; 43 | } 44 | @end 45 | -------------------------------------------------------------------------------- /CocoParticle/libs/cocos2d/CCTMXObjectGroup.h: -------------------------------------------------------------------------------- 1 | /* 2 | * cocos2d for iPhone: http://www.cocos2d-iphone.org 3 | * 4 | * Copyright (c) 2010 Ricardo Quesada 5 | * Copyright (c) 2010 Neophit 6 | * 7 | * Permission is hereby granted, free of charge, to any person obtaining a copy 8 | * of this software and associated documentation files (the "Software"), to deal 9 | * in the Software without restriction, including without limitation the rights 10 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the Software is 12 | * furnished to do so, subject to the following conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be included in 15 | * all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23 | * THE SOFTWARE. 24 | * 25 | * 26 | * TMX Tiled Map support: 27 | * http://www.mapeditor.org 28 | * 29 | */ 30 | 31 | #import "CCNode.h" 32 | 33 | 34 | @class CCTMXObjectGroup; 35 | 36 | 37 | /** CCTMXObjectGroup represents the TMX object group. 38 | @since v0.99.0 39 | */ 40 | @interface CCTMXObjectGroup : NSObject 41 | { 42 | NSString *groupName_; 43 | CGPoint positionOffset_; 44 | NSMutableArray *objects_; 45 | NSMutableDictionary *properties_; 46 | } 47 | 48 | /** name of the group */ 49 | @property (nonatomic,readwrite,retain) NSString *groupName; 50 | /** offset position of child objects */ 51 | @property (nonatomic,readwrite,assign) CGPoint positionOffset; 52 | /** array of the objects */ 53 | @property (nonatomic,readwrite,retain) NSMutableArray *objects; 54 | /** list of properties stored in a dictionary */ 55 | @property (nonatomic,readwrite,retain) NSMutableDictionary *properties; 56 | 57 | /** return the value for the specific property name */ 58 | -(id) propertyNamed:(NSString *)propertyName; 59 | 60 | /** return the dictionary for the specific object name. 61 | It will return the 1st object found on the array for the given name. 62 | */ 63 | -(NSMutableDictionary*) objectNamed:(NSString *)objectName; 64 | 65 | @end 66 | -------------------------------------------------------------------------------- /CocoParticle/libs/cocos2d/CCTMXObjectGroup.m: -------------------------------------------------------------------------------- 1 | /* 2 | * cocos2d for iPhone: http://www.cocos2d-iphone.org 3 | * 4 | * Copyright (c) 2010 Ricardo Quesada 5 | * Copyright (c) 2010 Neophit 6 | * 7 | * Permission is hereby granted, free of charge, to any person obtaining a copy 8 | * of this software and associated documentation files (the "Software"), to deal 9 | * in the Software without restriction, including without limitation the rights 10 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the Software is 12 | * furnished to do so, subject to the following conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be included in 15 | * all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23 | * THE SOFTWARE. 24 | * 25 | * 26 | * TMX Tiled Map support: 27 | * http://www.mapeditor.org 28 | * 29 | */ 30 | 31 | #import "CCTMXObjectGroup.h" 32 | #import "CCTMXXMLParser.h" 33 | #import "ccMacros.h" 34 | #import "Support/CGPointExtension.h" 35 | 36 | 37 | #pragma mark - 38 | #pragma mark TMXObjectGroup 39 | 40 | @implementation CCTMXObjectGroup 41 | 42 | @synthesize groupName = groupName_; 43 | @synthesize objects = objects_; 44 | @synthesize positionOffset = positionOffset_; 45 | @synthesize properties = properties_; 46 | 47 | -(id) init 48 | { 49 | if (( self=[super init] )) { 50 | self.groupName = nil; 51 | self.positionOffset = CGPointZero; 52 | self.objects = [NSMutableArray arrayWithCapacity:10]; 53 | self.properties = [NSMutableDictionary dictionaryWithCapacity:5]; 54 | } 55 | return self; 56 | } 57 | 58 | -(void) dealloc 59 | { 60 | CCLOGINFO( @"cocos2d: deallocing %@", self ); 61 | 62 | [groupName_ release]; 63 | [objects_ release]; 64 | [properties_ release]; 65 | [super dealloc]; 66 | } 67 | 68 | -(NSMutableDictionary*) objectNamed:(NSString *)objectName 69 | { 70 | for( id object in objects_ ) { 71 | if( [[object valueForKey:@"name"] isEqual:objectName] ) 72 | return object; 73 | } 74 | 75 | // object not found 76 | return nil; 77 | } 78 | 79 | -(id) propertyNamed:(NSString *)propertyName 80 | { 81 | return [properties_ valueForKey:propertyName]; 82 | } 83 | 84 | @end 85 | -------------------------------------------------------------------------------- /CocoParticle/libs/cocos2d/CCTileMapAtlas.h: -------------------------------------------------------------------------------- 1 | /* 2 | * cocos2d for iPhone: http://www.cocos2d-iphone.org 3 | * 4 | * Copyright (c) 2008-2010 Ricardo Quesada 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in 14 | * all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | * THE SOFTWARE. 23 | * 24 | */ 25 | 26 | #import "CCTextureAtlas.h" 27 | #import "CCAtlasNode.h" 28 | #import "Support/TGAlib.h" 29 | 30 | /** CCTileMapAtlas is a subclass of CCAtlasNode. 31 | 32 | It knows how to render a map based of tiles. 33 | The tiles must be in a .PNG format while the map must be a .TGA file. 34 | 35 | For more information regarding the format, please see this post: 36 | http://www.cocos2d-iphone.org/archives/27 37 | 38 | All features from CCAtlasNode are valid in CCTileMapAtlas 39 | 40 | IMPORTANT: 41 | This class is deprecated. It is maintained for compatibility reasons only. 42 | You SHOULD not use this class. 43 | Instead, use the newer TMX file format: CCTMXTiledMap 44 | */ 45 | @interface CCTileMapAtlas : CCAtlasNode 46 | { 47 | 48 | /// info about the map file 49 | tImageTGA *tgaInfo; 50 | 51 | /// x,y to altas dicctionary 52 | NSMutableDictionary *posToAtlasIndex; 53 | 54 | /// numbers of tiles to render 55 | int itemsToRender; 56 | } 57 | 58 | /** TileMap info */ 59 | @property (nonatomic,readonly) tImageTGA *tgaInfo; 60 | 61 | /** creates a CCTileMap with a tile file (atlas) with a map file and the width and height of each tile in points. 62 | The tile file will be loaded using the TextureMgr. 63 | */ 64 | +(id) tileMapAtlasWithTileFile:(NSString*)tile mapFile:(NSString*)map tileWidth:(int)w tileHeight:(int)h; 65 | 66 | /** initializes a CCTileMap with a tile file (atlas) with a map file and the width and height of each tile in points. 67 | The file will be loaded using the TextureMgr. 68 | */ 69 | -(id) initWithTileFile:(NSString*)tile mapFile:(NSString*)map tileWidth:(int)w tileHeight:(int)h; 70 | 71 | /** returns a tile from position x,y. 72 | For the moment only channel R is used 73 | */ 74 | -(ccColor3B) tileAt: (ccGridSize) position; 75 | 76 | /** sets a tile at position x,y. 77 | For the moment only channel R is used 78 | */ 79 | -(void) setTile:(ccColor3B)tile at:(ccGridSize)position; 80 | /** dealloc the map from memory */ 81 | -(void) releaseMap; 82 | @end 83 | -------------------------------------------------------------------------------- /CocoParticle/libs/cocos2d/CCTransitionPageTurn.h: -------------------------------------------------------------------------------- 1 | /* 2 | * cocos2d for iPhone: http://www.cocos2d-iphone.org 3 | * 4 | * Copyright (c) 2009 Sindesso Pty Ltd http://www.sindesso.com/ 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in 14 | * all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | * THE SOFTWARE. 23 | * 24 | */ 25 | 26 | 27 | #import "CCTransition.h" 28 | 29 | /** CCTransitionPageTurn transition. 30 | * A transition which peels back the bottom right hand corner of a scene 31 | * to transition to the scene beneath it simulating a page turn 32 | * 33 | * This uses a 3DAction so it's strongly recommended that depth buffering 34 | * is turned on in CCDirector using: 35 | * 36 | * [[CCDirector sharedDirector] setDepthBufferFormat:kCCDepthBuffer16]; 37 | * 38 | * @since v0.8.2 39 | */ 40 | @interface CCTransitionPageTurn : CCTransitionScene 41 | { 42 | BOOL back_; 43 | } 44 | /** 45 | * creates a base transition with duration and incoming scene 46 | * if back is TRUE then the effect is reversed to appear as if the incoming 47 | * scene is being turned from left over the outgoing scene 48 | */ 49 | +(id) transitionWithDuration:(ccTime) t scene:(CCScene*)s backwards:(BOOL) back; 50 | 51 | /** 52 | * creates a base transition with duration and incoming scene 53 | * if back is TRUE then the effect is reversed to appear as if the incoming 54 | * scene is being turned from left over the outgoing scene 55 | */ 56 | -(id) initWithDuration:(ccTime) t scene:(CCScene*)s backwards:(BOOL) back; 57 | 58 | -(CCActionInterval*) actionWithSize:(ccGridSize) vector; 59 | 60 | @end 61 | -------------------------------------------------------------------------------- /CocoParticle/libs/cocos2d/CCTransitionRadial.h: -------------------------------------------------------------------------------- 1 | /* 2 | * cocos2d for iPhone: http://www.cocos2d-iphone.org 3 | * 4 | * Copyright (c) 2009 Lam Pham 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in 14 | * all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | * THE SOFTWARE. 23 | * 24 | */ 25 | 26 | #import "CCTransition.h" 27 | #import "CCProgressTimer.h" 28 | #import "CCActionProgressTimer.h" 29 | 30 | /** CCTransitionRadialCCW transition. 31 | A counter colock-wise radial transition to the next scene 32 | */ 33 | @interface CCTransitionRadialCCW : CCTransitionScene 34 | @end 35 | 36 | /** CCTransitionRadialCW transition. 37 | A counter colock-wise radial transition to the next scene 38 | */ 39 | @interface CCTransitionRadialCW : CCTransitionRadialCCW 40 | @end 41 | -------------------------------------------------------------------------------- /CocoParticle/libs/cocos2d/Platforms/CCNS.h: -------------------------------------------------------------------------------- 1 | /* 2 | * cocos2d for iPhone: http://www.cocos2d-iphone.org 3 | * 4 | * Copyright (c) 2010 Ricardo Quesada 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in 14 | * all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | * THE SOFTWARE. 23 | */ 24 | 25 | // 26 | // Common layer for NS (Next-Step) stuff 27 | // 28 | 29 | #import 30 | 31 | #import // for NSObject 32 | 33 | #ifdef __IPHONE_OS_VERSION_MAX_ALLOWED 34 | 35 | #define CCRectFromString(__r__) CGRectFromString(__r__) 36 | #define CCPointFromString(__p__) CGPointFromString(__p__) 37 | #define CCSizeFromString(__s__) CGSizeFromString(__s__) 38 | #define CCNSSizeToCGSize 39 | #define CCNSRectToCGRect 40 | #define CCNSPointToCGPoint 41 | #define CCTextAlignment UITextAlignment 42 | #define CCTextAlignmentCenter UITextAlignmentCenter 43 | #define CCTextAlignmentLeft UITextAlignmentLeft 44 | #define CCTextAlignmentRight UITextAlignmentRight 45 | 46 | 47 | #elif defined(__MAC_OS_X_VERSION_MAX_ALLOWED) 48 | 49 | #define CCRectFromString(__r__) NSRectToCGRect( NSRectFromString(__r__) ) 50 | #define CCPointFromString(__p__) NSPointToCGPoint( NSPointFromString(__p__) ) 51 | #define CCSizeFromString(__s__) NSSizeToCGSize( NSSizeFromString(__s__) ) 52 | #define CCNSSizeToCGSize NSSizeToCGSize 53 | #define CCNSRectToCGRect NSRectToCGRect 54 | #define CCNSPointToCGPoint NSPointToCGPoint 55 | #define CCTextAlignment NSTextAlignment 56 | #define CCTextAlignmentCenter NSCenterTextAlignment 57 | #define CCTextAlignmentLeft NSLeftTextAlignment 58 | #define CCTextAlignmentRight NSRightTextAlignment 59 | 60 | #endif 61 | 62 | 63 | -------------------------------------------------------------------------------- /CocoParticle/libs/cocos2d/Platforms/Mac/MacWindow.h: -------------------------------------------------------------------------------- 1 | /* 2 | * cocos2d for iPhone: http://www.cocos2d-iphone.org 3 | * 4 | * Copyright (c) 2010 Ricardo Quesada 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in 14 | * all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | * THE SOFTWARE. 23 | */ 24 | 25 | // Only compile this code on Mac. These files should not be included on your iOS project. 26 | // But in case they are included, it won't be compiled. 27 | #import 28 | #ifdef __IPHONE_OS_VERSION_MAX_ALLOWED 29 | #elif defined(__MAC_OS_X_VERSION_MAX_ALLOWED) 30 | 31 | #import 32 | 33 | 34 | @interface MacWindow : NSWindow 35 | { 36 | } 37 | - (id) initWithFrame:(NSRect)frame fullscreen:(BOOL)fullscreen; 38 | 39 | @end 40 | 41 | 42 | #endif // __MAC_OS_X_VERSION_MAX_ALLOWED -------------------------------------------------------------------------------- /CocoParticle/libs/cocos2d/Platforms/Mac/MacWindow.m: -------------------------------------------------------------------------------- 1 | /* 2 | * cocos2d for iPhone: http://www.cocos2d-iphone.org 3 | * 4 | * Copyright (c) 2010 Ricardo Quesada 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in 14 | * all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | * THE SOFTWARE. 23 | */ 24 | 25 | // Only compile this code on Mac. These files should not be included on your iOS project. 26 | // But in case they are included, it won't be compiled. 27 | #import 28 | #ifdef __IPHONE_OS_VERSION_MAX_ALLOWED 29 | #elif defined(__MAC_OS_X_VERSION_MAX_ALLOWED) 30 | 31 | #import "MacWindow.h" 32 | 33 | 34 | @implementation MacWindow 35 | 36 | - (id) initWithFrame:(NSRect)frame fullscreen:(BOOL)fullscreen 37 | { 38 | int styleMask = fullscreen ? NSBackingStoreBuffered : ( NSTitledWindowMask | NSClosableWindowMask ); 39 | self = [self initWithContentRect:frame 40 | styleMask:styleMask 41 | backing:NSBackingStoreBuffered 42 | defer:YES]; 43 | 44 | if (self != nil) 45 | { 46 | if(fullscreen) 47 | { 48 | [self setLevel:NSMainMenuWindowLevel+1]; 49 | [self setHidesOnDeactivate:YES]; 50 | [self setHasShadow:NO]; 51 | } 52 | 53 | [self setAcceptsMouseMovedEvents:NO]; 54 | [self setOpaque:YES]; 55 | } 56 | return self; 57 | } 58 | 59 | - (BOOL) canBecomeKeyWindow 60 | { 61 | return YES; 62 | } 63 | 64 | - (BOOL) canBecomeMainWindow 65 | { 66 | return YES; 67 | } 68 | @end 69 | 70 | #endif // __MAC_OS_X_VERSION_MAX_ALLOWED 71 | -------------------------------------------------------------------------------- /CocoParticle/libs/cocos2d/Platforms/iOS/ES1Renderer.h: -------------------------------------------------------------------------------- 1 | /* 2 | * cocos2d for iPhone: http://www.cocos2d-iphone.org 3 | * 4 | * Copyright (c) 2010 Ricardo Quesada 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in 14 | * all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | * THE SOFTWARE. 23 | * 24 | * 25 | * File autogenerated with Xcode. Adapted for cocos2d needs. 26 | */ 27 | 28 | // Only compile this code on iOS. These files should NOT be included on your Mac project. 29 | // But in case they are included, it won't be compiled. 30 | #import 31 | #ifdef __IPHONE_OS_VERSION_MAX_ALLOWED 32 | 33 | 34 | #import "ESRenderer.h" 35 | 36 | #import 37 | #import 38 | 39 | @interface ES1Renderer : NSObject 40 | { 41 | // The pixel dimensions of the CAEAGLLayer 42 | GLint backingWidth_; 43 | GLint backingHeight_; 44 | 45 | unsigned int samplesToUse_; 46 | BOOL multiSampling_; 47 | 48 | unsigned int depthFormat_; 49 | unsigned int pixelFormat_; 50 | 51 | // The OpenGL ES names for the framebuffer and renderbuffer used to render to this view 52 | GLuint defaultFramebuffer_; 53 | GLuint colorRenderbuffer_; 54 | GLuint depthBuffer_; 55 | 56 | 57 | //buffers for MSAA 58 | GLuint msaaFramebuffer_; 59 | GLuint msaaColorbuffer_; 60 | 61 | EAGLContext *context_; 62 | } 63 | 64 | /** EAGLContext */ 65 | @property (nonatomic,readonly) EAGLContext* context; 66 | 67 | - (BOOL)resizeFromLayer:(CAEAGLLayer *)layer; 68 | 69 | @end 70 | 71 | #endif // __IPHONE_OS_VERSION_MAX_ALLOWED 72 | -------------------------------------------------------------------------------- /CocoParticle/libs/cocos2d/Platforms/iOS/ESRenderer.h: -------------------------------------------------------------------------------- 1 | /* 2 | * cocos2d for iPhone: http://www.cocos2d-iphone.org 3 | * 4 | * Copyright (c) 2010 Ricardo Quesada 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in 14 | * all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | * THE SOFTWARE. 23 | * 24 | * 25 | * File autogenerated with Xcode. Adapted for cocos2d needs. 26 | */ 27 | 28 | // Only compile this code on iOS. These files should NOT be included on your Mac project. 29 | // But in case they are included, it won't be compiled. 30 | #import 31 | #ifdef __IPHONE_OS_VERSION_MAX_ALLOWED 32 | 33 | #import 34 | 35 | #import 36 | #import 37 | 38 | @protocol ESRenderer 39 | 40 | - (id) initWithDepthFormat:(unsigned int)depthFormat withPixelFormat:(unsigned int)pixelFormat withSharegroup:(EAGLSharegroup*)sharegroup withMultiSampling:(BOOL) multiSampling withNumberOfSamples:(unsigned int) requestedSamples; 41 | 42 | - (BOOL) resizeFromLayer:(CAEAGLLayer *)layer; 43 | 44 | - (EAGLContext*) context; 45 | - (CGSize) backingSize; 46 | 47 | - (unsigned int) colorRenderBuffer; 48 | - (unsigned int) defaultFrameBuffer; 49 | - (unsigned int) msaaFrameBuffer; 50 | - (unsigned int) msaaColorBuffer; 51 | @end 52 | 53 | #endif // __IPHONE_OS_VERSION_MAX_ALLOWED 54 | -------------------------------------------------------------------------------- /CocoParticle/libs/cocos2d/Platforms/iOS/glu.c: -------------------------------------------------------------------------------- 1 | // 2 | // cocos2d (incomplete) GLU implementation 3 | // 4 | // gluLookAt and gluPerspective from: 5 | // http://jet.ro/creations (San Angeles Observation) 6 | // 7 | // 8 | 9 | // Only compile this code on iOS. These files should NOT be included on your Mac project. 10 | // But in case they are included, it won't be compiled. 11 | #import 12 | #ifdef __IPHONE_OS_VERSION_MAX_ALLOWED 13 | 14 | #import 15 | #import 16 | #import "../../Support/OpenGL_Internal.h" 17 | #include "glu.h" 18 | 19 | void gluPerspective(GLfloat fovy, GLfloat aspect, GLfloat zNear, GLfloat zFar) 20 | { 21 | GLfloat xmin, xmax, ymin, ymax; 22 | 23 | ymax = zNear * (GLfloat)tanf(fovy * (float)M_PI / 360); 24 | ymin = -ymax; 25 | xmin = ymin * aspect; 26 | xmax = ymax * aspect; 27 | 28 | glFrustumf(xmin, xmax, 29 | ymin, ymax, 30 | zNear, zFar); 31 | } 32 | 33 | void gluLookAt(GLfloat eyex, GLfloat eyey, GLfloat eyez, 34 | GLfloat centerx, GLfloat centery, GLfloat centerz, 35 | GLfloat upx, GLfloat upy, GLfloat upz) 36 | { 37 | GLfloat m[16]; 38 | GLfloat x[3], y[3], z[3]; 39 | GLfloat mag; 40 | 41 | /* Make rotation matrix */ 42 | 43 | /* Z vector */ 44 | z[0] = eyex - centerx; 45 | z[1] = eyey - centery; 46 | z[2] = eyez - centerz; 47 | mag = (float)sqrtf(z[0] * z[0] + z[1] * z[1] + z[2] * z[2]); 48 | if (mag) { 49 | z[0] /= mag; 50 | z[1] /= mag; 51 | z[2] /= mag; 52 | } 53 | 54 | /* Y vector */ 55 | y[0] = upx; 56 | y[1] = upy; 57 | y[2] = upz; 58 | 59 | /* X vector = Y cross Z */ 60 | x[0] = y[1] * z[2] - y[2] * z[1]; 61 | x[1] = -y[0] * z[2] + y[2] * z[0]; 62 | x[2] = y[0] * z[1] - y[1] * z[0]; 63 | 64 | /* Recompute Y = Z cross X */ 65 | y[0] = z[1] * x[2] - z[2] * x[1]; 66 | y[1] = -z[0] * x[2] + z[2] * x[0]; 67 | y[2] = z[0] * x[1] - z[1] * x[0]; 68 | 69 | /* cross product gives area of parallelogram, which is < 1.0 for 70 | * non-perpendicular unit-length vectors; so normalize x, y here 71 | */ 72 | 73 | mag = (float)sqrtf(x[0] * x[0] + x[1] * x[1] + x[2] * x[2]); 74 | if (mag) { 75 | x[0] /= mag; 76 | x[1] /= mag; 77 | x[2] /= mag; 78 | } 79 | 80 | mag = (float)sqrtf(y[0] * y[0] + y[1] * y[1] + y[2] * y[2]); 81 | if (mag) { 82 | y[0] /= mag; 83 | y[1] /= mag; 84 | y[2] /= mag; 85 | } 86 | 87 | #define M(row,col) m[col*4+row] 88 | M(0, 0) = x[0]; 89 | M(0, 1) = x[1]; 90 | M(0, 2) = x[2]; 91 | M(0, 3) = 0.0f; 92 | M(1, 0) = y[0]; 93 | M(1, 1) = y[1]; 94 | M(1, 2) = y[2]; 95 | M(1, 3) = 0.0f; 96 | M(2, 0) = z[0]; 97 | M(2, 1) = z[1]; 98 | M(2, 2) = z[2]; 99 | M(2, 3) = 0.0f; 100 | M(3, 0) = 0.0f; 101 | M(3, 1) = 0.0f; 102 | M(3, 2) = 0.0f; 103 | M(3, 3) = 1.0f; 104 | #undef M 105 | 106 | glMultMatrixf(m); 107 | 108 | 109 | /* Translate Eye to Origin */ 110 | glTranslatef(-eyex, -eyey, -eyez); 111 | } 112 | 113 | #endif // __IPHONE_OS_VERSION_MAX_ALLOWED 114 | -------------------------------------------------------------------------------- /CocoParticle/libs/cocos2d/Platforms/iOS/glu.h: -------------------------------------------------------------------------------- 1 | // 2 | // cocos2d GLU implementation 3 | // 4 | // implementation of GLU functions 5 | // 6 | #ifndef __COCOS2D_GLU_H 7 | #define __COCOS2D_GLU_H 8 | 9 | // Only compile this code on iOS. These files should NOT be included on your Mac project. 10 | // But in case they are included, it won't be compiled. 11 | #import 12 | #ifdef __IPHONE_OS_VERSION_MAX_ALLOWED 13 | 14 | #import 15 | 16 | /** 17 | @file 18 | cocos2d OpenGL GLU implementation 19 | */ 20 | 21 | /** OpenGL gluLookAt implementation */ 22 | void gluLookAt(float eyeX, float eyeY, float eyeZ, float lookAtX, float lookAtY, float lookAtZ, float upX, float upY, float upZ); 23 | /** OpenGL gluPerspective implementation */ 24 | void gluPerspective(GLfloat fovy, GLfloat aspect, GLfloat zNear, GLfloat zFar); 25 | 26 | #endif // __IPHONE_OS_VERSION_MAX_ALLOWED 27 | 28 | #endif /* __COCOS2D_GLU_H */ 29 | 30 | -------------------------------------------------------------------------------- /CocoParticle/libs/cocos2d/Support/CCFileUtils.h: -------------------------------------------------------------------------------- 1 | /* 2 | * cocos2d for iPhone: http://www.cocos2d-iphone.org 3 | * 4 | * Copyright (c) 2008-2010 Ricardo Quesada 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in 14 | * all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | * THE SOFTWARE. 23 | * 24 | */ 25 | 26 | 27 | #import 28 | 29 | 30 | /** Helper class to handle file operations */ 31 | @interface CCFileUtils : NSObject 32 | { 33 | } 34 | 35 | /** Returns the fullpath of an filename. 36 | 37 | If this method is when Retina Display is enabled, then the 38 | Retina Display suffix will be appended to the file (See ccConfig.h). 39 | 40 | If the Retina Display image doesn't exist, then it will return the "non-Retina Display" image 41 | 42 | */ 43 | +(NSString*) fullPathFromRelativePath:(NSString*) relPath; 44 | @end 45 | 46 | /** loads a file into memory. 47 | the caller should release the allocated buffer. 48 | 49 | @returns the size of the allocated buffer 50 | @since v0.99.5 51 | */ 52 | NSInteger ccLoadFileIntoMemory(const char *filename, unsigned char **out); 53 | 54 | 55 | /** removes the HD suffix from a path 56 | 57 | @returns NSString * without the HD suffix 58 | @since v0.99.5 59 | */ 60 | NSString *ccRemoveHDSuffixFromFile( NSString *path ); 61 | 62 | -------------------------------------------------------------------------------- /CocoParticle/libs/cocos2d/Support/CCProfiling.h: -------------------------------------------------------------------------------- 1 | /* 2 | * cocos2d for iPhone: http://www.cocos2d-iphone.org 3 | * 4 | * Copyright (c) 2010 Stuart Carnie 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in 14 | * all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | * THE SOFTWARE. 23 | * 24 | */ 25 | 26 | 27 | #import 28 | #import 29 | 30 | @class CCProfilingTimer; 31 | 32 | @interface CCProfiler : NSObject { 33 | NSMutableArray* activeTimers; 34 | } 35 | 36 | + (CCProfiler*)sharedProfiler; 37 | + (CCProfilingTimer*)timerWithName:(NSString*)timerName andInstance:(id)instance; 38 | + (void)releaseTimer:(CCProfilingTimer*)timer; 39 | - (void)displayTimers; 40 | 41 | @end 42 | 43 | 44 | @interface CCProfilingTimer : NSObject { 45 | NSString* name; 46 | struct timeval startTime; 47 | double averageTime; 48 | } 49 | 50 | @end 51 | 52 | extern void CCProfilingBeginTimingBlock(CCProfilingTimer* timer); 53 | extern void CCProfilingEndTimingBlock(CCProfilingTimer* timer); 54 | -------------------------------------------------------------------------------- /CocoParticle/libs/cocos2d/Support/TGAlib.h: -------------------------------------------------------------------------------- 1 | // 2 | // TGA lib for cocos2d-iphone 3 | // 4 | // sources from: http://www.lighthouse3d.com/opengl/terrain/index.php3?tgasource 5 | // 6 | 7 | //#ifndef TGA_LIB 8 | //#define TGA_LIB 9 | 10 | /** 11 | @file 12 | TGA image support 13 | */ 14 | 15 | enum { 16 | TGA_OK, 17 | TGA_ERROR_FILE_OPEN, 18 | TGA_ERROR_READING_FILE, 19 | TGA_ERROR_INDEXED_COLOR, 20 | TGA_ERROR_MEMORY, 21 | TGA_ERROR_COMPRESSED_FILE, 22 | }; 23 | 24 | /** TGA format */ 25 | typedef struct sImageTGA { 26 | int status; 27 | unsigned char type, pixelDepth; 28 | 29 | /** map width */ 30 | short int width; 31 | 32 | /** map height */ 33 | short int height; 34 | 35 | /** raw data */ 36 | unsigned char *imageData; 37 | int flipped; 38 | } tImageTGA; 39 | 40 | /// load the image header fields. We only keep those that matter! 41 | void tgaLoadHeader(FILE *file, tImageTGA *info); 42 | 43 | /// loads the image pixels. You shouldn't call this function directly 44 | void tgaLoadImageData(FILE *file, tImageTGA *info); 45 | 46 | /// this is the function to call when we want to load an image 47 | tImageTGA * tgaLoad(const char *filename); 48 | 49 | // /converts RGB to greyscale 50 | void tgaRGBtogreyscale(tImageTGA *info); 51 | 52 | /// releases the memory used for the image 53 | void tgaDestroy(tImageTGA *info); 54 | 55 | //#endif // TGA_LIB 56 | -------------------------------------------------------------------------------- /CocoParticle/libs/cocos2d/Support/TransformUtils.h: -------------------------------------------------------------------------------- 1 | /* 2 | * cocos2d for iPhone: http://www.cocos2d-iphone.org 3 | * 4 | * Copyright (c) 2009 Valentin Milea 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in 14 | * all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | * THE SOFTWARE. 23 | * 24 | */ 25 | 26 | #import 27 | 28 | #ifdef __IPHONE_OS_VERSION_MAX_ALLOWED 29 | #import 30 | #import 31 | #elif defined(__MAC_OS_X_VERSION_MAX_ALLOWED) 32 | #import 33 | #import 34 | #endif 35 | 36 | void CGAffineToGL(const CGAffineTransform *t, GLfloat *m); 37 | void GLToCGAffine(const GLfloat *m, CGAffineTransform *t); 38 | -------------------------------------------------------------------------------- /CocoParticle/libs/cocos2d/Support/TransformUtils.m: -------------------------------------------------------------------------------- 1 | /* 2 | * cocos2d for iPhone: http://www.cocos2d-iphone.org 3 | * 4 | * Copyright (c) 2009 Valentin Milea 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in 14 | * all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | * THE SOFTWARE. 23 | * 24 | */ 25 | 26 | 27 | #import "TransformUtils.h" 28 | 29 | void CGAffineToGL(const CGAffineTransform *t, GLfloat *m) 30 | { 31 | // | m[0] m[4] m[8] m[12] | | m11 m21 m31 m41 | | a c 0 tx | 32 | // | m[1] m[5] m[9] m[13] | | m12 m22 m32 m42 | | b d 0 ty | 33 | // | m[2] m[6] m[10] m[14] | <=> | m13 m23 m33 m43 | <=> | 0 0 1 0 | 34 | // | m[3] m[7] m[11] m[15] | | m14 m24 m34 m44 | | 0 0 0 1 | 35 | 36 | m[2] = m[3] = m[6] = m[7] = m[8] = m[9] = m[11] = m[14] = 0.0f; 37 | m[10] = m[15] = 1.0f; 38 | m[0] = t->a; m[4] = t->c; m[12] = t->tx; 39 | m[1] = t->b; m[5] = t->d; m[13] = t->ty; 40 | } 41 | 42 | void GLToCGAffine(const GLfloat *m, CGAffineTransform *t) 43 | { 44 | t->a = m[0]; t->c = m[4]; t->tx = m[12]; 45 | t->b = m[1]; t->d = m[5]; t->ty = m[13]; 46 | } 47 | -------------------------------------------------------------------------------- /CocoParticle/libs/cocos2d/Support/ZipUtils.h: -------------------------------------------------------------------------------- 1 | /* cocos2d for iPhone 2 | * 3 | * http://www.cocos2d-iphone.org 4 | * 5 | * 6 | * inflateMemory_ based on zlib example code 7 | * http://www.zlib.net 8 | * 9 | * Some ideas were taken from: 10 | * http://themanaworld.org/ 11 | * from the mapreader.cpp file 12 | * 13 | */ 14 | 15 | #ifndef __CC_ZIP_UTILS_H 16 | #define __CC_ZIP_UTILS_H 17 | 18 | #import 19 | 20 | #ifdef __cplusplus 21 | extern "C" { 22 | #endif 23 | 24 | /* XXX: pragma pack ??? */ 25 | /** @struct CCZHeader 26 | */ 27 | struct CCZHeader { 28 | uint8_t sig[4]; // signature. Should be 'CCZ!' 4 bytes 29 | uint16_t compression_type; // should 0 30 | uint16_t version; // should be 2 (although version type==1 is also supported) 31 | uint32_t reserved; // Reserverd for users. 32 | uint32_t len; // size of the uncompressed file 33 | }; 34 | 35 | enum { 36 | CCZ_COMPRESSION_ZLIB, // zlib format. 37 | CCZ_COMPRESSION_BZIP2, // bzip2 format (not supported yet) 38 | CCZ_COMPRESSION_GZIP, // gzip format (not supported yet) 39 | CCZ_COMPRESSION_NONE, // plain (not supported yet) 40 | }; 41 | 42 | /** @file 43 | * Zip helper functions 44 | */ 45 | 46 | /** 47 | * Inflates either zlib or gzip deflated memory. The inflated memory is 48 | * expected to be freed by the caller. 49 | * 50 | * @returns the length of the deflated buffer 51 | * 52 | @since v0.8.1 53 | */ 54 | int ccInflateMemory(unsigned char *in, unsigned int inLength, unsigned char **out); 55 | 56 | 57 | /** inflates a GZip file into memory 58 | * 59 | * @returns the length of the deflated buffer 60 | * 61 | * @since v0.99.5 62 | */ 63 | int ccInflateGZipFile(const char *filename, unsigned char **out); 64 | 65 | /** inflates a CCZ file into memory 66 | * 67 | * @returns the length of the deflated buffer 68 | * 69 | * @since v0.99.5 70 | */ 71 | int ccInflateCCZFile(const char *filename, unsigned char **out); 72 | 73 | 74 | #ifdef __cplusplus 75 | } 76 | #endif 77 | 78 | #endif // __CC_ZIP_UTILS_H 79 | -------------------------------------------------------------------------------- /CocoParticle/libs/cocos2d/Support/base64.c: -------------------------------------------------------------------------------- 1 | /* 2 | public domain BASE64 code 3 | 4 | modified for cocos2d-iphone: http://www.cocos2d-iphone.org 5 | */ 6 | 7 | #include 8 | #include 9 | 10 | unsigned char alphabet[64] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; 11 | 12 | int _base64Decode( unsigned char *input, unsigned int input_len, unsigned char *output, unsigned int *output_len ) 13 | { 14 | static char inalphabet[256], decoder[256]; 15 | int i, bits, c, char_count, errors = 0; 16 | unsigned int input_idx = 0; 17 | unsigned int output_idx = 0; 18 | 19 | for (i = (sizeof alphabet) - 1; i >= 0 ; i--) { 20 | inalphabet[alphabet[i]] = 1; 21 | decoder[alphabet[i]] = i; 22 | } 23 | 24 | char_count = 0; 25 | bits = 0; 26 | for( input_idx=0; input_idx < input_len ; input_idx++ ) { 27 | c = input[ input_idx ]; 28 | if (c == '=') 29 | break; 30 | if (c > 255 || ! inalphabet[c]) 31 | continue; 32 | bits += decoder[c]; 33 | char_count++; 34 | if (char_count == 4) { 35 | output[ output_idx++ ] = (bits >> 16); 36 | output[ output_idx++ ] = ((bits >> 8) & 0xff); 37 | output[ output_idx++ ] = ( bits & 0xff); 38 | bits = 0; 39 | char_count = 0; 40 | } else { 41 | bits <<= 6; 42 | } 43 | } 44 | 45 | if( c == '=' ) { 46 | switch (char_count) { 47 | case 1: 48 | fprintf(stderr, "base64Decode: encoding incomplete: at least 2 bits missing"); 49 | errors++; 50 | break; 51 | case 2: 52 | output[ output_idx++ ] = ( bits >> 10 ); 53 | break; 54 | case 3: 55 | output[ output_idx++ ] = ( bits >> 16 ); 56 | output[ output_idx++ ] = (( bits >> 8 ) & 0xff); 57 | break; 58 | } 59 | } else if ( input_idx < input_len ) { 60 | if (char_count) { 61 | fprintf(stderr, "base64 encoding incomplete: at least %d bits truncated", 62 | ((4 - char_count) * 6)); 63 | errors++; 64 | } 65 | } 66 | 67 | *output_len = output_idx; 68 | return errors; 69 | } 70 | 71 | int base64Decode(unsigned char *in, unsigned int inLength, unsigned char **out) 72 | { 73 | unsigned int outLength = 0; 74 | 75 | //should be enough to store 6-bit buffers in 8-bit buffers 76 | *out = malloc( inLength * 3.0f / 4.0f + 1 ); 77 | if( *out ) { 78 | int ret = _base64Decode(in, inLength, *out, &outLength); 79 | 80 | if (ret > 0 ) 81 | { 82 | printf("Base64Utils: error decoding"); 83 | free(*out); 84 | *out = NULL; 85 | outLength = 0; 86 | } 87 | } 88 | return outLength; 89 | } 90 | -------------------------------------------------------------------------------- /CocoParticle/libs/cocos2d/Support/base64.h: -------------------------------------------------------------------------------- 1 | /* 2 | public domain BASE64 code 3 | 4 | modified for cocos2d-iphone: http://www.cocos2d-iphone.org 5 | */ 6 | 7 | #ifndef __CC_BASE64_DECODE_H 8 | #define __CC_BASE64_DECODE_H 9 | 10 | #ifdef __cplusplus 11 | extern "C" { 12 | #endif 13 | 14 | 15 | /** @file 16 | base64 helper functions 17 | */ 18 | 19 | /** 20 | * Decodes a 64base encoded memory. The decoded memory is 21 | * expected to be freed by the caller. 22 | * 23 | * @returns the length of the out buffer 24 | * 25 | @since v0.8.1 26 | */ 27 | int base64Decode(unsigned char *in, unsigned int inLength, unsigned char **out); 28 | 29 | #ifdef __cplusplus 30 | } 31 | #endif 32 | 33 | #endif // __CC_BASE64_DECODE_H 34 | -------------------------------------------------------------------------------- /CocoParticle/libs/cocos2d/Support/ccUtils.c: -------------------------------------------------------------------------------- 1 | /* 2 | * cocos2d for iPhone: http://www.cocos2d-iphone.org 3 | * 4 | */ 5 | 6 | /* 7 | ccNextPOT function is licensed under the same license that is used in CCTexture2D.m. 8 | */ 9 | #include "ccUtils.h" 10 | 11 | unsigned long ccNextPOT(unsigned long x) 12 | { 13 | x = x - 1; 14 | x = x | (x >> 1); 15 | x = x | (x >> 2); 16 | x = x | (x >> 4); 17 | x = x | (x >> 8); 18 | x = x | (x >>16); 19 | return x + 1; 20 | } -------------------------------------------------------------------------------- /CocoParticle/libs/cocos2d/Support/ccUtils.h: -------------------------------------------------------------------------------- 1 | /* 2 | * cocos2d for iPhone: http://www.cocos2d-iphone.org 3 | * 4 | */ 5 | 6 | #ifndef __CC_UTILS_H 7 | #define __CC_UTILS_H 8 | 9 | /** @file ccUtils.h 10 | Misc free functions 11 | */ 12 | 13 | /* 14 | ccNextPOT function is licensed under the same license that is used in CCTexture2D.m. 15 | */ 16 | 17 | /** returns the Next Power of Two value. 18 | 19 | Examples: 20 | - If "value" is 15, it will return 16. 21 | - If "value" is 16, it will return 16. 22 | - If "value" is 17, it will return 32. 23 | 24 | @since v0.99.5 25 | */ 26 | 27 | unsigned long ccNextPOT( unsigned long value ); 28 | 29 | #endif // ! __CC_UTILS_H 30 | -------------------------------------------------------------------------------- /CocoParticle/libs/cocos2d/cocos2d.m: -------------------------------------------------------------------------------- 1 | /* 2 | * cocos2d for iPhone: http://www.cocos2d-iphone.org 3 | * 4 | * Copyright (c) 2008-2010 Ricardo Quesada 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in 14 | * all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | * THE SOFTWARE. 23 | */ 24 | 25 | 26 | #import 27 | 28 | static NSString *version = @"cocos2d v1.0.0-rc"; 29 | 30 | NSString *cocos2dVersion() 31 | { 32 | return version; 33 | } 34 | -------------------------------------------------------------------------------- /CocoParticle/libs/cocoslive/cocoslive.h: -------------------------------------------------------------------------------- 1 | /* 2 | * cocos2d for iPhone: http://www.cocos2d-iphone.org 3 | * 4 | * Copyright (c) 2008-2010 Ricardo Quesada 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in 14 | * all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | * THE SOFTWARE. 23 | * 24 | */ 25 | 26 | 27 | 28 | // 0x00 HI ME LO 29 | // 00 00 03 02 30 | #define COCOSLIVE_VERSION 0x00000302 31 | 32 | // to use localserver. DEBUG ONLY 33 | //#define USE_LOCAL_SERVER 1 34 | 35 | // all cocos live include files 36 | // 37 | #import "CLScoreServerPost.h" 38 | #import "CLScoreServerRequest.h" 39 | 40 | 41 | // free functions 42 | NSString * cocos2dVersion(void); 43 | -------------------------------------------------------------------------------- /CocoParticle/libs/cocoslive/cocoslive.m: -------------------------------------------------------------------------------- 1 | /* 2 | * cocos2d for iPhone: http://www.cocos2d-iphone.org 3 | * 4 | * Copyright (c) 2008-2010 Ricardo Quesada 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in 14 | * all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | * THE SOFTWARE. 23 | * 24 | */ 25 | 26 | 27 | #import 28 | 29 | static NSString *version = @"cocoslive v0.3.2"; 30 | 31 | NSString *cocosLiveVersion() 32 | { 33 | return version; 34 | } 35 | -------------------------------------------------------------------------------- /CocoParticle/list_lines.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tayl0r/CocoParticle/55f8223d918e0d6601b5fef7bed53bb99b763434/CocoParticle/list_lines.png -------------------------------------------------------------------------------- /CocoParticle/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // CocoParticle 4 | // 5 | // Created by Taylor Steil on 7/10/11. 6 | // Copyright __MyCompanyName__ 2011. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | int main(int argc, char *argv[]) { 12 | 13 | NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; 14 | int retVal = UIApplicationMain(argc, argv, nil, @"AppDelegate"); 15 | [pool release]; 16 | return retVal; 17 | } 18 | -------------------------------------------------------------------------------- /CocoParticle/preferences_gear_2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tayl0r/CocoParticle/55f8223d918e0d6601b5fef7bed53bb99b763434/CocoParticle/preferences_gear_2.png -------------------------------------------------------------------------------- /CocoParticle/preferences_gear_5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tayl0r/CocoParticle/55f8223d918e0d6601b5fef7bed53bb99b763434/CocoParticle/preferences_gear_5.png -------------------------------------------------------------------------------- /CocoParticle/preferences_settings.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tayl0r/CocoParticle/55f8223d918e0d6601b5fef7bed53bb99b763434/CocoParticle/preferences_settings.png -------------------------------------------------------------------------------- /DropBoxVC.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import "DropboxSDK.h" 3 | 4 | @interface DropBoxVC : UIViewController { 5 | UIButton* linkButton; 6 | DBRestClient* m_dbRestClient; 7 | } 8 | 9 | -(void) updateButtons; 10 | -(void) saveParticle:(NSNotification*)notif; 11 | 12 | @end 13 | -------------------------------------------------------------------------------- /README: -------------------------------------------------------------------------------- 1 | CocoParticle is intended to be used by Cocos2d app developers who want to create particles for their apps. 2 | 3 | Features: 4 | * supports every particle system property of Cocos2d 5 | * imports png files for use as the "particle" 6 | * exports particles as a plist to your Drop Box, which you can use to create a Cocos2d particle system 7 | 8 | Right now the app is setup as a UISplitViewController where the left (small) pane is a native UIView where you manage the particles. 9 | The main pane is a Cocos2d view where the particle is displayed. 10 | 11 | * bug with particle list name, it reads it from a different row for some reason when you create a new particle, but when you refresh the list it picks up the correct name, gotta dig into it 12 | 13 | * need a randomize button 14 | 15 | * need better default values 16 | 17 | * added support for "all particles the same color", so if you have a random color and this is turned on, instead of each particle being a random color, they will all be the same random color -------------------------------------------------------------------------------- /TSParticleSystemQuad.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import "cocos2d.h" 3 | 4 | @interface TSParticleSystemQuad : CCParticleSystemQuad { 5 | BOOL m_endColorEnabled; 6 | BOOL m_allParticlesSameColor; 7 | BOOL m_colorSet; 8 | ccColor4F m_particleColor; 9 | ccColor4F m_particleDeltaColor; 10 | } 11 | 12 | @end 13 | -------------------------------------------------------------------------------- /TSParticleSystemQuad.m: -------------------------------------------------------------------------------- 1 | #import "TSParticleSystemQuad.h" 2 | 3 | 4 | @implementation TSParticleSystemQuad 5 | 6 | -(id) initWithDictionary:(NSDictionary *)dictionary 7 | { 8 | if ((self = [super initWithDictionary:dictionary])) { 9 | 10 | // fix the emission rate 11 | if ([dictionary objectForKey:@"emissionRate"]) { 12 | float value = [[dictionary objectForKey:@"emissionRate"] floatValue]; 13 | if (value > 0.0) { 14 | emissionRate = value; 15 | } 16 | } 17 | 18 | // if end color is disabled, set it to the beginning color 19 | m_endColorEnabled = YES; 20 | if ([dictionary objectForKey:@"finishColorEnabled"]) { 21 | BOOL value = [[dictionary objectForKey:@"finishColorEnabled"] boolValue]; 22 | m_endColorEnabled = value; 23 | if (value == NO) { 24 | endColor = startColor; 25 | endColorVar = startColorVar; 26 | } 27 | } 28 | 29 | // if all particles are the same color, just save the flag 30 | m_colorSet = NO; 31 | m_allParticlesSameColor = NO; 32 | if ([dictionary objectForKey:@"allParticlesSameColor"]) { 33 | BOOL value = [[dictionary objectForKey:@"allParticlesSameColor"] boolValue]; 34 | m_allParticlesSameColor = value; 35 | } 36 | } 37 | return self; 38 | } 39 | 40 | -(void) initParticle:(tCCParticle *)particle 41 | { 42 | [super initParticle:particle]; 43 | if (m_endColorEnabled == NO) { 44 | particle->deltaColor.r = 0; 45 | particle->deltaColor.g = 0; 46 | particle->deltaColor.b = 0; 47 | } 48 | if (m_allParticlesSameColor) { 49 | if (m_colorSet) { 50 | particle->color = m_particleColor; 51 | particle->deltaColor = m_particleDeltaColor; 52 | } 53 | else { 54 | m_colorSet = YES; 55 | m_particleColor = particle->color; 56 | m_particleDeltaColor = particle->deltaColor; 57 | } 58 | } 59 | } 60 | 61 | @end 62 | -------------------------------------------------------------------------------- /ss1.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tayl0r/CocoParticle/55f8223d918e0d6601b5fef7bed53bb99b763434/ss1.PNG -------------------------------------------------------------------------------- /ss2.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tayl0r/CocoParticle/55f8223d918e0d6601b5fef7bed53bb99b763434/ss2.PNG --------------------------------------------------------------------------------