├── td ├── Resources │ ├── Icon.png │ ├── minus.png │ ├── plus.png │ ├── Default.png │ ├── Icon-72.png │ ├── Icon@2x.png │ ├── Icon-Small.png │ ├── fps_images.png │ ├── iTunesArtwork │ ├── Icon-Small-50.png │ ├── Icon-Small@2x.png │ ├── terraindemo.bmp │ ├── terraindemo.png │ ├── grossini_dance_atlas.png │ └── Info.plist ├── libs │ ├── Chipmunk │ │ ├── libChipmunkPro-iPhone.a │ │ ├── ChipmunkHastySpace.h │ │ ├── cpHastySpace.h │ │ ├── ObjectiveChipmunk.h │ │ ├── ChipmunkPointCloudSampler.h │ │ ├── ChipmunkObject.h │ │ ├── ChipmunkMultiGrab.h │ │ ├── cpMarch.h │ │ ├── chipmunk │ │ │ ├── constraints │ │ │ │ ├── cpSimpleMotor.h │ │ │ │ ├── cpPinJoint.h │ │ │ │ ├── cpRotaryLimitJoint.h │ │ │ │ ├── cpGearJoint.h │ │ │ │ ├── cpRatchetJoint.h │ │ │ │ ├── cpPivotJoint.h │ │ │ │ ├── cpSlideJoint.h │ │ │ │ ├── cpGrooveJoint.h │ │ │ │ ├── cpDampedRotarySpring.h │ │ │ │ └── cpDampedSpring.h │ │ │ ├── chipmunk_unsafe.h │ │ │ └── cpPolyShape.h │ │ ├── ChipmunkExtras.h │ │ └── cpPolyline.h │ ├── TouchJSON │ │ ├── JSON │ │ │ ├── JSONRepresentation.h │ │ │ ├── CJSONSerializer.h │ │ │ └── CJSONDeserializer.h │ │ ├── Extensions │ │ │ ├── NSDictionary_JSONExtensions.h │ │ │ ├── CDataScanner_Extensions.h │ │ │ └── NSDictionary_JSONExtensions.m │ │ └── CDataScanner.h │ ├── cocos2d │ │ ├── Support │ │ │ ├── ccUtils.c │ │ │ ├── ccUtils.h │ │ │ ├── base64.h │ │ │ ├── TGAlib.h │ │ │ ├── TransformUtils.h │ │ │ ├── CCProfiling.h │ │ │ ├── TransformUtils.m │ │ │ ├── CCFileUtils.h │ │ │ ├── ZipUtils.h │ │ │ └── base64.c │ │ ├── Platforms │ │ │ ├── iOS │ │ │ │ ├── glu.h │ │ │ │ ├── ESRenderer.h │ │ │ │ ├── ES1Renderer.h │ │ │ │ ├── glu.c │ │ │ │ └── CCTouchDelegateProtocol.h │ │ │ ├── Mac │ │ │ │ ├── MacWindow.h │ │ │ │ ├── MacWindow.m │ │ │ │ └── MacGLView.h │ │ │ ├── CCGL.h │ │ │ └── CCNS.h │ │ ├── cocos2d.m │ │ ├── CCBlockSupport.m │ │ ├── CCGrabber.h │ │ ├── CCScene.m │ │ ├── CCTransitionRadial.h │ │ ├── CCActionPageTurn3D.h │ │ ├── CCScene.h │ │ ├── CCBlockSupport.h │ │ ├── CCParallaxNode.h │ │ ├── CCActionTween.m │ │ ├── CCParticleSystemPoint.h │ │ ├── CCActionProgressTimer.h │ │ ├── CCAnimationCache.h │ │ ├── CCTMXObjectGroup.h │ │ ├── CCTransitionPageTurn.h │ │ ├── CCActionTween.h │ │ ├── CCTMXObjectGroup.m │ │ ├── CCLabelAtlas.h │ │ ├── CCActionCamera.h │ │ ├── CCParticleSystemQuad.h │ │ ├── CCActionPageTurn3D.m │ │ ├── CCMotionStreak.h │ │ ├── CCAnimationCache.m │ │ ├── CCGrabber.m │ │ ├── CCProgressTimer.h │ │ ├── CCTileMapAtlas.h │ │ ├── CCMenu.h │ │ ├── CCParticleExamples.h │ │ ├── CCActionProgressTimer.m │ │ ├── CCAnimation.m │ │ ├── CCDrawingPrimitives.h │ │ └── CCAnimation.h │ ├── FontLabel │ │ ├── ZAttributedStringPrivate.h │ │ ├── ZFont.h │ │ ├── FontLabel.h │ │ └── ZAttributedString.h │ ├── LICENSE_TouchJSON.txt │ ├── LICENSE_Chipmunk.txt │ ├── LICENSE_CocosDenshion.txt │ ├── LICENSE_cocos2d.txt │ ├── cocoslive │ │ ├── cocoslive.m │ │ └── cocoslive.h │ └── CocosDenshion │ │ └── CDConfig.h ├── RootViewController.h ├── Prefix.pch ├── main.m ├── AppDelegate.h ├── RootViewController.m ├── GameConfig.h ├── pgeWorld.h ├── HelloWorldLayer.h └── pgeTerrain.h └── td.xcodeproj ├── project.xcworkspace ├── contents.xcworkspacedata └── xcuserdata │ └── Lars.xcuserdatad │ └── UserInterfaceState.xcuserstate └── xcuserdata └── Lars.xcuserdatad └── xcschemes ├── xcschememanagement.plist └── td.xcscheme /td/Resources/Icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Birkemose/td/HEAD/td/Resources/Icon.png -------------------------------------------------------------------------------- /td/Resources/minus.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Birkemose/td/HEAD/td/Resources/minus.png -------------------------------------------------------------------------------- /td/Resources/plus.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Birkemose/td/HEAD/td/Resources/plus.png -------------------------------------------------------------------------------- /td/Resources/Default.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Birkemose/td/HEAD/td/Resources/Default.png -------------------------------------------------------------------------------- /td/Resources/Icon-72.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Birkemose/td/HEAD/td/Resources/Icon-72.png -------------------------------------------------------------------------------- /td/Resources/Icon@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Birkemose/td/HEAD/td/Resources/Icon@2x.png -------------------------------------------------------------------------------- /td/Resources/Icon-Small.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Birkemose/td/HEAD/td/Resources/Icon-Small.png -------------------------------------------------------------------------------- /td/Resources/fps_images.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Birkemose/td/HEAD/td/Resources/fps_images.png -------------------------------------------------------------------------------- /td/Resources/iTunesArtwork: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Birkemose/td/HEAD/td/Resources/iTunesArtwork -------------------------------------------------------------------------------- /td/Resources/Icon-Small-50.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Birkemose/td/HEAD/td/Resources/Icon-Small-50.png -------------------------------------------------------------------------------- /td/Resources/Icon-Small@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Birkemose/td/HEAD/td/Resources/Icon-Small@2x.png -------------------------------------------------------------------------------- /td/Resources/terraindemo.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Birkemose/td/HEAD/td/Resources/terraindemo.bmp -------------------------------------------------------------------------------- /td/Resources/terraindemo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Birkemose/td/HEAD/td/Resources/terraindemo.png -------------------------------------------------------------------------------- /td/Resources/grossini_dance_atlas.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Birkemose/td/HEAD/td/Resources/grossini_dance_atlas.png -------------------------------------------------------------------------------- /td/libs/Chipmunk/libChipmunkPro-iPhone.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Birkemose/td/HEAD/td/libs/Chipmunk/libChipmunkPro-iPhone.a -------------------------------------------------------------------------------- /td.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /td.xcodeproj/project.xcworkspace/xcuserdata/Lars.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Birkemose/td/HEAD/td.xcodeproj/project.xcworkspace/xcuserdata/Lars.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /td/RootViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // RootViewController.h 3 | // terrainDemo 4 | // 5 | // Created by Lars Birkemose on 03/02/12. 6 | // Copyright Protec Electronics 2012. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | 12 | @interface RootViewController : UIViewController { 13 | 14 | } 15 | 16 | @end 17 | -------------------------------------------------------------------------------- /td/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 | -------------------------------------------------------------------------------- /td/libs/Chipmunk/ChipmunkHastySpace.h: -------------------------------------------------------------------------------- 1 | /// ChipmunkHastySpace is an Objective-Chipmunk wrapper for cpHastySpace and is only available with Chipmunk Pro. 2 | /// Subclass this class instead of ChipmunkSpace if you want to enable the cpHastySpace optimizations. 3 | /// If ChipmunkHastySpace is linked correctly, calling [[ChipmunkSpace alloc] init] will actually return a ChipmunkHastySpace. 4 | @interface ChipmunkHastySpace : ChipmunkSpace 5 | @end 6 | -------------------------------------------------------------------------------- /td/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 | -------------------------------------------------------------------------------- /td/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // td 4 | // 5 | // Created by Lars Birkemose on 14/02/12. 6 | // Copyright __MyCompanyName__ 2012. 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 | -------------------------------------------------------------------------------- /td/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // terrainDemo 4 | // 5 | // Created by Lars Birkemose on 03/02/12. 6 | // Copyright Protec Electronics 2012. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @class RootViewController; 12 | 13 | @interface AppDelegate : NSObject { 14 | UIWindow *window; 15 | RootViewController *viewController; 16 | } 17 | 18 | @property (nonatomic, retain) UIWindow *window; 19 | 20 | @end 21 | -------------------------------------------------------------------------------- /td/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 | } -------------------------------------------------------------------------------- /td/libs/Chipmunk/cpHastySpace.h: -------------------------------------------------------------------------------- 1 | /// cpHastySpace is exclusive to Chipmunk Pro 2 | /// Currently it enables ARM NEON optimizations in the solver, but in the future will include other optimizations such as 3 | /// a multi-threaded solver and multi-threaded collision broadphases. 4 | typedef struct cpHastySpace { 5 | cpSpace space; 6 | } cpHastySpace; 7 | 8 | /// Create a new hasty space. 9 | cpSpace *cpHastySpaceNew(void); 10 | 11 | /// When stepping a hasty space, you must use this function. 12 | void cpHastySpaceStep(cpSpace *space, cpFloat dt); 13 | -------------------------------------------------------------------------------- /td.xcodeproj/xcuserdata/Lars.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | td.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | 4608303914EA3AC10050DF8A 16 | 17 | primary 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /td/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 | -------------------------------------------------------------------------------- /td/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 | -------------------------------------------------------------------------------- /td/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 | -------------------------------------------------------------------------------- /td/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 | -------------------------------------------------------------------------------- /td/RootViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // RootViewController.m 3 | // terrainDemo 4 | // 5 | // Created by Lars Birkemose on 03/02/12. 6 | // Copyright Protec Electronics 2012. All rights reserved. 7 | // 8 | 9 | // 10 | // RootViewController + iAd 11 | // If you want to support iAd, use this class as the controller of your iAd 12 | // 13 | 14 | #import "cocos2d.h" 15 | 16 | #import "RootViewController.h" 17 | #import "GameConfig.h" 18 | 19 | @implementation RootViewController 20 | 21 | - (void)didReceiveMemoryWarning { 22 | // Releases the view if it doesn't have a superview. 23 | [super didReceiveMemoryWarning]; 24 | 25 | // Release any cached data, images, etc that aren't in use. 26 | } 27 | 28 | - (void)viewDidUnload { 29 | [super viewDidUnload]; 30 | // Release any retained subviews of the main view. 31 | // e.g. self.myOutlet = nil; 32 | } 33 | 34 | 35 | - (void)dealloc { 36 | [super dealloc]; 37 | } 38 | 39 | 40 | @end 41 | 42 | -------------------------------------------------------------------------------- /td/libs/Chipmunk/ObjectiveChipmunk.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import 3 | 4 | #if TARGET_OS_IPHONE 5 | #import 6 | #endif 7 | 8 | // Override some Chipmunk types for Objective-Chipmunk 9 | #define CP_USE_CGPOINTS 1 10 | 11 | #if __has_feature(objc_arc) 12 | #define CP_DATA_POINTER_TYPE __unsafe_unretained id 13 | #define CP_GROUP_TYPE __unsafe_unretained id 14 | #define CP_COLLISION_TYPE_TYPE __unsafe_unretained id 15 | #else 16 | #define CP_DATA_POINTER_TYPE id 17 | #define CP_GROUP_TYPE id 18 | #define CP_COLLISION_TYPE_TYPE id 19 | #endif 20 | 21 | #ifdef CP_ALLOW_PRIVATE_ACCESS 22 | #undef CP_ALLOW_PRIVATE_ACCESS 23 | #import "chipmunk/chipmunk_private.h" 24 | #else 25 | #import "chipmunk/chipmunk.h" 26 | #endif 27 | 28 | #import "ChipmunkObject.h" 29 | #import "ChipmunkBody.h" 30 | #import "ChipmunkShape.h" 31 | #import "ChipmunkConstraint.h" 32 | #import "ChipmunkSpace.h" 33 | #import "ChipmunkExtras.h" 34 | 35 | #import "ChipmunkMultiGrab.h" 36 | -------------------------------------------------------------------------------- /td/libs/Chipmunk/ChipmunkPointCloudSampler.h: -------------------------------------------------------------------------------- 1 | #import "ObjectiveChipmunk.h" 2 | #import "ChipmunkAutoGeometry.h" 3 | 4 | /** 5 | A point cloud sampler allows you to perform deformable terrain like with a bitmap backed sampler, 6 | but without any bounds. It only requires memory for the points you add instead of large RAM chewing bitmap. 7 | However, unlike a bitmap, the deformation can only go one way. (i.e. You can add or remove terrain, but not both). 8 | Without any points, the sampler will return 1.0. Adding points will put "holes" in it causing it to return lower values. 9 | */ 10 | @interface ChipmunkPointCloudSampler : ChipmunkAbstractSampler { 11 | @private 12 | cpFloat _cellSize; 13 | cpSpatialIndex *_index; 14 | } 15 | 16 | /// Initialize the sampler with the given cell size, 17 | /// which should roughly match the size of the points added to the sampler. 18 | - (id)initWithCellSize:(cpFloat)cellSize; 19 | 20 | /// Add a point to the cloud and return the dirty rect for the point. 21 | -(cpBB)addPoint:(cpVect)pos radius:(cpFloat)radius fuzz:(cpFloat)fuzz; 22 | 23 | @end 24 | -------------------------------------------------------------------------------- /td/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. -------------------------------------------------------------------------------- /td/libs/LICENSE_Chipmunk.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2007 Scott Lembcke and Howling Moon Software 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in 11 | all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 19 | SOFTWARE. 20 | -------------------------------------------------------------------------------- /td/libs/Chipmunk/ChipmunkObject.h: -------------------------------------------------------------------------------- 1 | @class ChipmunkSpace; 2 | 3 | /** 4 | Allows you to add composite objects to a space in a single method call. 5 | The easiest way to implement the ChipmunkObject protocol is to add a @c chipmunkObjects instance variable with a type of @c NSArray* to your class, 6 | create a synthesized property for it, and initialize it with the ChipmunkObjectFlatten() function. 7 | */ 8 | @protocol ChipmunkObject 9 | 10 | /// Returns a set of ChipmunkBaseObject objects. 11 | - (id )chipmunkObjects; 12 | 13 | @end 14 | 15 | /// @deprecated since 6.0.2 Use [NSArray arrayWithObjects:] or similar instead. 16 | NSSet * ChipmunkObjectFlatten(id firstObject, ...) __attribute__((deprecated)); 17 | 18 | /** 19 | This protocol is implemented by objects that know how to add themselves to a space. 20 | It's used internally as part of the ChipmunkObject protocol. You should never need to implement it yourself. 21 | */ 22 | @protocol ChipmunkBaseObject 23 | 24 | @property (assign) id data; 25 | 26 | - (void)addToSpace:(ChipmunkSpace *)space; 27 | - (void)removeFromSpace:(ChipmunkSpace *)space; 28 | 29 | @end 30 | -------------------------------------------------------------------------------- /td/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. -------------------------------------------------------------------------------- /td/libs/Chipmunk/ChipmunkMultiGrab.h: -------------------------------------------------------------------------------- 1 | #import "ObjectiveChipmunk.h" 2 | 3 | /// Simple class to implement multitouch grabbing of physics objects. 4 | @interface ChipmunkMultiGrab : NSObject { 5 | ChipmunkSpace *_space; 6 | NSMutableArray *_grabs; 7 | 8 | cpFloat _smoothing; 9 | cpFloat _force; 10 | 11 | cpLayers _layers; 12 | cpGroup _group; 13 | } 14 | 15 | /// Layers used for the point query when grabbing objects. 16 | @property(nonatomic, assign) cpLayers layers; 17 | 18 | /// Group used for the point query when grabbing objects 19 | @property(nonatomic, assign) cpGroup group; 20 | 21 | /** 22 | @c space is the space to grab shapes in. 23 | @c smoothing is the amount of mouse smoothing to apply as percentage of remaining error per second. 24 | cpfpow(0.8, 60) is a good starting point that provides fast response, but smooth mouse updates. 25 | @c force is the force the grab points can apply. 26 | */ 27 | -(id)initForSpace:(ChipmunkSpace *)space withSmoothing:(cpFloat)smoothing withGrabForce:(cpFloat)force; 28 | 29 | /// Start tracking a new grab point 30 | -(BOOL)beginLocation:(cpVect)pos; 31 | 32 | /// Update a grab point. 33 | -(void)updateLocation:(cpVect)pos; 34 | 35 | /// End a grab point. 36 | -(void)endLocation:(cpVect)pos; 37 | 38 | @end 39 | -------------------------------------------------------------------------------- /td/libs/LICENSE_cocos2d.txt: -------------------------------------------------------------------------------- 1 | cocos2d for iPhone: http://www.cocos2d-iphone.org 2 | 3 | Copyright (c) 2011 - Zynga Inc. 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 | -------------------------------------------------------------------------------- /td/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 | -------------------------------------------------------------------------------- /td/libs/cocos2d/cocos2d.m: -------------------------------------------------------------------------------- 1 | /* 2 | * cocos2d for iPhone: http://www.cocos2d-iphone.org 3 | * 4 | * Copyright (c) 2008-2010 Ricardo Quesada 5 | * Copyright (c) 2011 Zynga Inc. 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 | #import 28 | #import "cocos2d.h" 29 | static NSString *version = @"cocos2d v1.0.1"; 30 | 31 | NSString *cocos2dVersion() 32 | { 33 | return version; 34 | } 35 | -------------------------------------------------------------------------------- /td/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 | UIStatusBarHidden 39 | 40 | UIRequiredDeviceCapabilities 41 | 42 | accelerometer 43 | 44 | opengles-1 45 | 46 | 47 | 48 | 49 | -------------------------------------------------------------------------------- /td/libs/cocoslive/cocoslive.m: -------------------------------------------------------------------------------- 1 | /* 2 | * cocos2d for iPhone: http://www.cocos2d-iphone.org 3 | * 4 | * Copyright (c) 2008-2010 Ricardo Quesada 5 | * Copyright (c) 2011 Zynga Inc. 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 29 | 30 | #import "cocoslive.h" 31 | 32 | static NSString *version = @"cocoslive v0.3.2"; 33 | 34 | NSString *cocosLiveVersion() 35 | { 36 | return version; 37 | } 38 | -------------------------------------------------------------------------------- /td/GameConfig.h: -------------------------------------------------------------------------------- 1 | // 2 | // GameConfig.h 3 | // terrainDemo 4 | // 5 | // Created by Lars Birkemose on 03/02/12. 6 | // Copyright Protec Electronics 2012. All rights reserved. 7 | // 8 | 9 | #ifndef __GAME_CONFIG_H 10 | #define __GAME_CONFIG_H 11 | 12 | // basic setups 13 | 14 | #define GAME_DEBUG_DRAW 1 15 | #define GAME_FPS 30.0f 16 | 17 | // misc game defines 18 | 19 | #define GAME_COLLISION_TERRAIN ( id )1 20 | 21 | // old setups 22 | 23 | // Supported Autorotations: 24 | // None, 25 | // UIViewController, 26 | // CCDirector 27 | // 28 | #define kGameAutorotationNone 0 29 | #define kGameAutorotationCCDirector 1 30 | #define kGameAutorotationUIViewController 2 31 | 32 | // 33 | // Define here the type of autorotation that you want for your game 34 | // 35 | 36 | // 3rd generation and newer devices: Rotate using UIViewController. Rotation should be supported on iPad apps. 37 | // TIP: 38 | // To improve the performance, you should set this value to "kGameAutorotationNone" or "kGameAutorotationCCDirector" 39 | #if defined(__ARM_NEON__) || TARGET_IPHONE_SIMULATOR 40 | #define GAME_AUTOROTATION kGameAutorotationUIViewController 41 | 42 | // ARMv6 (1st and 2nd generation devices): Don't rotate. It is very expensive 43 | #elif __arm__ 44 | #define GAME_AUTOROTATION kGameAutorotationNone 45 | 46 | 47 | // Ignore this value on Mac 48 | #elif defined(__MAC_OS_X_VERSION_MAX_ALLOWED) 49 | 50 | #else 51 | #error(unknown architecture) 52 | #endif 53 | 54 | #endif // __GAME_CONFIG_H 55 | 56 | -------------------------------------------------------------------------------- /td/pgeWorld.h: -------------------------------------------------------------------------------- 1 | // 2 | // pgeWorld.h 3 | // terrainDemo 4 | // 5 | // Created by Lars Birkemose on 03/02/12. 6 | // Copyright (c) 2012 Protec Electronics. All rights reserved. 7 | // 8 | // ---------------------------------------------------------- 9 | // import headers 10 | 11 | #import "GameConfig.h" 12 | #import 13 | #import "cocos2d.h" 14 | #import "ObjectiveChipmunk.h" 15 | 16 | #import "pgeTerrain.h" 17 | 18 | // ---------------------------------------------------------- 19 | // defines 20 | 21 | #define WORLD [ pgeWorld sharedWorld ] 22 | #define WORLD_GRAVITY -500 23 | #define WORLD_DAMPING 0.5f 24 | 25 | // ---------------------------------------------------------- 26 | // typedefs 27 | 28 | // ---------------------------------------------------------- 29 | // interface 30 | 31 | @interface pgeWorld : CCNode { 32 | ChipmunkSpace* m_space; 33 | NSMutableArray* m_ballList; 34 | pgeTerrain* m_terrain; 35 | } 36 | 37 | // ---------------------------------------------------------- 38 | // properties 39 | 40 | @property ( readonly ) ChipmunkSpace* space; 41 | @property ( readonly ) pgeTerrain* terrain; 42 | 43 | // ---------------------------------------------------------- 44 | // methods 45 | 46 | +( pgeWorld* )sharedWorld; 47 | -( pgeWorld* )init; 48 | 49 | -( void )update:( ccTime )dt; 50 | 51 | -( void )addBall:( CGPoint )pos; 52 | 53 | // ---------------------------------------------------------- 54 | 55 | @end 56 | -------------------------------------------------------------------------------- /td/libs/Chipmunk/cpMarch.h: -------------------------------------------------------------------------------- 1 | /// Function type used as a callback from the marching squares algorithm to sample an image function. 2 | /// It passes you the point to sample and your context pointer, and you return the density. 3 | typedef cpFloat (*cpMarchSampleFunc)(cpVect point, void *data); 4 | 5 | /// Function type used as a callback from the marching squares algorithm to output a line segment. 6 | /// It passes you the two endpoints and your context pointer. 7 | typedef void (*cpMarchSegmentFunc)(cpVect v0, cpVect v1, void *data); 8 | 9 | /// Trace an anti-aliased contour of an image along a particular threshold. 10 | /// The given number of samples will be taken and spread across the bounding box area using the sampling function and context. 11 | /// The segment function will be called for each segment detected that lies along the density contour for @c threshold. 12 | void cpMarchSoft( 13 | cpBB bb, int x_samples, int y_samples, cpFloat threshold, 14 | cpMarchSegmentFunc segment, void *segment_data, 15 | cpMarchSampleFunc sample, void *sample_data 16 | ); 17 | 18 | /// Trace an aliased curve of an image along a particular threshold. 19 | /// The given number of samples will be taken and spread across the bounding box area using the sampling function and context. 20 | /// The segment function will be called for each segment detected that lies along the density contour for @c threshold. 21 | void cpMarchHard( 22 | cpBB bb, int x_samples, int y_samples, cpFloat threshold, 23 | cpMarchSegmentFunc segment, void *segment_data, 24 | cpMarchSampleFunc sample, void *sample_data 25 | ); 26 | -------------------------------------------------------------------------------- /td/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 | -------------------------------------------------------------------------------- /td/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 | -------------------------------------------------------------------------------- /td/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 | -------------------------------------------------------------------------------- /td/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 | -------------------------------------------------------------------------------- /td/libs/cocoslive/cocoslive.h: -------------------------------------------------------------------------------- 1 | /* 2 | * cocos2d for iPhone: http://www.cocos2d-iphone.org 3 | * 4 | * Copyright (c) 2008-2010 Ricardo Quesada 5 | * Copyright (c) 2011 Zynga Inc. 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 | 29 | // 0x00 HI ME LO 30 | // 00 00 03 02 31 | #define COCOSLIVE_VERSION 0x00000302 32 | 33 | // to use localserver. DEBUG ONLY 34 | //#define USE_LOCAL_SERVER 1 35 | 36 | // all cocos live include files 37 | // 38 | #import "CLScoreServerPost.h" 39 | #import "CLScoreServerRequest.h" 40 | 41 | 42 | // free functions 43 | NSString * cocosLiveVersion(void); 44 | -------------------------------------------------------------------------------- /td/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 | -------------------------------------------------------------------------------- /td/libs/cocos2d/CCScene.m: -------------------------------------------------------------------------------- 1 | /* 2 | * cocos2d for iPhone: http://www.cocos2d-iphone.org 3 | * 4 | * Copyright (c) 2008-2010 Ricardo Quesada 5 | * Copyright (c) 2011 Zynga Inc. 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 "CCScene.h" 29 | #import "Support/CGPointExtension.h" 30 | #import "CCDirector.h" 31 | 32 | 33 | @implementation CCScene 34 | -(id) init 35 | { 36 | if( (self=[super init]) ) { 37 | CGSize s = [[CCDirector sharedDirector] winSize]; 38 | self.isRelativeAnchorPoint = NO; 39 | anchorPoint_ = ccp(0.5f, 0.5f); 40 | [self setContentSize:s]; 41 | } 42 | 43 | return self; 44 | } 45 | @end 46 | -------------------------------------------------------------------------------- /td/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 | -------------------------------------------------------------------------------- /td/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 | -------------------------------------------------------------------------------- /td/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 -------------------------------------------------------------------------------- /td/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 | -------------------------------------------------------------------------------- /td/HelloWorldLayer.h: -------------------------------------------------------------------------------- 1 | // 2 | // HelloWorldLayer.h 3 | // terrainDemo 4 | // 5 | // Created by Lars Birkemose on 03/02/12. 6 | // Copyright Protec Electronics 2012. All rights reserved. 7 | // 8 | // ---------------------------------------------------------- 9 | 10 | #import "GameConfig.h" 11 | #import "cocos2d.h" 12 | #import "ObjectiveChipmunk.h" 13 | #import 14 | 15 | #import "pgeTerrain.h" 16 | #import "pgeWorld.h" 17 | 18 | // ---------------------------------------------------------- 19 | 20 | #define PLUS_FILE @"plus.png" 21 | #define PLUS_POSITION CGPointMake( -70, -30 ) 22 | 23 | #define MINUS_FILE @"minus.png" 24 | #define MINUS_POSITION CGPointMake( -30, -30 ) 25 | 26 | #define BUTTON_COLOR_OFF ccORANGE 27 | #define BUTTON_COLOR_ON ccYELLOW 28 | 29 | #define BUTTON_DETECTION_RANGE 32 30 | 31 | #define EDIT_INTERVAL 0.05f 32 | 33 | #define EDIT_TERRAIN_SIZE 24 34 | 35 | // ---------------------------------------------------------- 36 | 37 | typedef enum { 38 | USER_MODE_BALL, 39 | USER_MODE_ADD, 40 | USER_MODE_REMOVE, 41 | } USER_MODE; 42 | 43 | // ---------------------------------------------------------- 44 | 45 | @interface HelloWorldLayer : CCLayer { 46 | pgeTerrain* m_terrain; 47 | CCSprite* m_plus; 48 | CCSprite* m_minus; 49 | USER_MODE m_mode; 50 | 51 | float m_terrainTimer; 52 | } 53 | 54 | // ---------------------------------------------------------- 55 | 56 | // ---------------------------------------------------------- 57 | 58 | +( CCScene* )scene; 59 | -( void )animate:( ccTime )dt; 60 | 61 | // ---------------------------------------------------------- 62 | 63 | @end 64 | -------------------------------------------------------------------------------- /td/libs/cocos2d/CCScene.h: -------------------------------------------------------------------------------- 1 | /* 2 | * cocos2d for iPhone: http://www.cocos2d-iphone.org 3 | * 4 | * Copyright (c) 2008-2010 Ricardo Quesada 5 | * Copyright (c) 2011 Zynga Inc. 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 "CCNode.h" 29 | 30 | /** CCScene is a subclass of CCNode that is used only as an abstract concept. 31 | 32 | CCScene an CCNode are almost identical with the difference that CCScene has it's 33 | anchor point (by default) at the center of the screen. 34 | 35 | For the moment CCScene has no other logic than that, but in future releases it might have 36 | additional logic. 37 | 38 | It is a good practice to use and CCScene as the parent of all your nodes. 39 | */ 40 | @interface CCScene : CCNode 41 | { 42 | } 43 | @end 44 | -------------------------------------------------------------------------------- /td/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 | -------------------------------------------------------------------------------- /td/libs/Chipmunk/chipmunk/constraints/cpSimpleMotor.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2007 Scott Lembcke 2 | * 3 | * Permission is hereby granted, free of charge, to any person obtaining a copy 4 | * of this software and associated documentation files (the "Software"), to deal 5 | * in the Software without restriction, including without limitation the rights 6 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | * copies of the Software, and to permit persons to whom the Software is 8 | * furnished to do so, subject to the following conditions: 9 | * 10 | * The above copyright notice and this permission notice shall be included in 11 | * all copies or substantial portions of the Software. 12 | * 13 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 19 | * SOFTWARE. 20 | */ 21 | 22 | /// @defgroup cpSimpleMotor cpSimpleMotor 23 | /// @{ 24 | 25 | const cpConstraintClass *cpSimpleMotorGetClass(void); 26 | 27 | /// @private 28 | typedef struct cpSimpleMotor { 29 | cpConstraint constraint; 30 | cpFloat rate; 31 | 32 | cpFloat iSum; 33 | 34 | cpFloat jAcc, jMax; 35 | } cpSimpleMotor; 36 | 37 | /// Allocate a simple motor. 38 | cpSimpleMotor* cpSimpleMotorAlloc(void); 39 | /// initialize a simple motor. 40 | cpSimpleMotor* cpSimpleMotorInit(cpSimpleMotor *joint, cpBody *a, cpBody *b, cpFloat rate); 41 | /// Allocate and initialize a simple motor. 42 | cpConstraint* cpSimpleMotorNew(cpBody *a, cpBody *b, cpFloat rate); 43 | 44 | CP_DefineConstraintProperty(cpSimpleMotor, cpFloat, rate, Rate); 45 | 46 | /// @} 47 | -------------------------------------------------------------------------------- /td/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 | -------------------------------------------------------------------------------- /td/libs/Chipmunk/ChipmunkExtras.h: -------------------------------------------------------------------------------- 1 | #define ChipmunkGetObject(s) s->data 2 | #define ChipmunkGetData(s) [s->data data] 3 | 4 | @interface ChipmunkBody (Extras) 5 | 6 | /// Get an affine transform to match this body. 7 | - (CGAffineTransform)affineTransform; 8 | 9 | @end 10 | 11 | /// Redundant API used to implement higher level functionality such as addObject. 12 | @interface ChipmunkSpace (Extras) 13 | 14 | /// Add a border of collision segments around a box. See ChipmunkShape for more information on the other parameters. 15 | - (void)addBounds:(CGRect)bounds thickness:(cpFloat)radius 16 | elasticity:(cpFloat)elasticity friction:(cpFloat)friction 17 | layers:(cpLayers)layers group:(id)group 18 | collisionType:(id)collisionType; 19 | 20 | /// Add a body to the space. Normally you would simply use ChipmunkSpace.add:. 21 | - (ChipmunkBody *)addBody:(ChipmunkBody *)obj; 22 | /// Remove a body to the space. Normally you would simply use ChipmunkSpace.remove:. 23 | - (ChipmunkBody *)removeBody:(ChipmunkBody *)obj; 24 | 25 | /// Add a shape to the space. Normally you would simply use ChipmunkSpace.add:. 26 | - (ChipmunkShape *)addShape:(ChipmunkShape *)obj; 27 | /// Remove a shape to the space. Normally you would simply use ChipmunkSpace.remove:. 28 | - (ChipmunkShape *)removeShape:(ChipmunkShape *)obj; 29 | 30 | /// Add a static shape to the space. Normally you would simply create a static shape use ChipmunkSpace.add:. 31 | - (ChipmunkShape *)addStaticShape:(ChipmunkShape *)obj; 32 | /// Remove a static shape to the space. Normally you would simply create a static shape use ChipmunkSpace.remove:. 33 | - (ChipmunkShape *)removeStaticShape:(ChipmunkShape *)obj; 34 | 35 | /// Add a constraint to the space. Normally you would simply use ChipmunkSpace.add:. 36 | - (ChipmunkConstraint *)addConstraint:(ChipmunkConstraint *)obj; 37 | /// Remove a constraint to the space. Normally you would simply use ChipmunkSpace.remove:. 38 | - (ChipmunkConstraint *)removeConstraint:(ChipmunkConstraint *)obj; 39 | 40 | @end 41 | -------------------------------------------------------------------------------- /td/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 | -------------------------------------------------------------------------------- /td/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 | -------------------------------------------------------------------------------- /td/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 | -------------------------------------------------------------------------------- /td/libs/cocos2d/CCParallaxNode.h: -------------------------------------------------------------------------------- 1 | /* 2 | * cocos2d for iPhone: http://www.cocos2d-iphone.org 3 | * 4 | * Copyright (c) 2009-2010 Ricardo Quesada 5 | * Copyright (c) 2011 Zynga Inc. 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 | #import "CCNode.h" 28 | #import "Support/ccCArray.h" 29 | 30 | /** CCParallaxNode: A node that simulates a parallax scroller 31 | 32 | The children will be moved faster / slower than the parent according the the parallax ratio. 33 | 34 | */ 35 | @interface CCParallaxNode : CCNode 36 | { 37 | ccArray *parallaxArray_; 38 | CGPoint lastPosition; 39 | } 40 | 41 | /** array that holds the offset / ratio of the children */ 42 | @property (nonatomic,readwrite) ccArray * parallaxArray; 43 | 44 | /** Adds a child to the container with a z-order, a parallax ratio and a position offset 45 | It returns self, so you can chain several addChilds. 46 | @since v0.8 47 | */ 48 | -(void) addChild: (CCNode*)node z:(NSInteger)z parallaxRatio:(CGPoint)c positionOffset:(CGPoint)positionOffset; 49 | 50 | @end 51 | -------------------------------------------------------------------------------- /td/libs/Chipmunk/chipmunk/constraints/cpPinJoint.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2007 Scott Lembcke 2 | * 3 | * Permission is hereby granted, free of charge, to any person obtaining a copy 4 | * of this software and associated documentation files (the "Software"), to deal 5 | * in the Software without restriction, including without limitation the rights 6 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | * copies of the Software, and to permit persons to whom the Software is 8 | * furnished to do so, subject to the following conditions: 9 | * 10 | * The above copyright notice and this permission notice shall be included in 11 | * all copies or substantial portions of the Software. 12 | * 13 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 19 | * SOFTWARE. 20 | */ 21 | 22 | /// @defgroup cpPinJoint cpPinJoint 23 | /// @{ 24 | 25 | const cpConstraintClass *cpPinJointGetClass(void); 26 | 27 | /// @private 28 | typedef struct cpPinJoint { 29 | cpConstraint constraint; 30 | cpVect anchr1, anchr2; 31 | cpFloat dist; 32 | 33 | cpVect r1, r2; 34 | cpVect n; 35 | cpFloat nMass; 36 | 37 | cpFloat jnAcc, jnMax; 38 | cpFloat bias; 39 | } cpPinJoint; 40 | 41 | /// Allocate a pin joint. 42 | cpPinJoint* cpPinJointAlloc(void); 43 | /// Initialize a pin joint. 44 | cpPinJoint* cpPinJointInit(cpPinJoint *joint, cpBody *a, cpBody *b, cpVect anchr1, cpVect anchr2); 45 | /// Allocate and initialize a pin joint. 46 | cpConstraint* cpPinJointNew(cpBody *a, cpBody *b, cpVect anchr1, cpVect anchr2); 47 | 48 | CP_DefineConstraintProperty(cpPinJoint, cpVect, anchr1, Anchr1); 49 | CP_DefineConstraintProperty(cpPinJoint, cpVect, anchr2, Anchr2); 50 | CP_DefineConstraintProperty(cpPinJoint, cpFloat, dist, Dist); 51 | 52 | ///@} 53 | -------------------------------------------------------------------------------- /td/libs/Chipmunk/chipmunk/constraints/cpRotaryLimitJoint.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2007 Scott Lembcke 2 | * 3 | * Permission is hereby granted, free of charge, to any person obtaining a copy 4 | * of this software and associated documentation files (the "Software"), to deal 5 | * in the Software without restriction, including without limitation the rights 6 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | * copies of the Software, and to permit persons to whom the Software is 8 | * furnished to do so, subject to the following conditions: 9 | * 10 | * The above copyright notice and this permission notice shall be included in 11 | * all copies or substantial portions of the Software. 12 | * 13 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 19 | * SOFTWARE. 20 | */ 21 | 22 | /// @defgroup cpRotaryLimitJoint cpRotaryLimitJoint 23 | /// @{ 24 | 25 | const cpConstraintClass *cpRotaryLimitJointGetClass(void); 26 | 27 | /// @private 28 | typedef struct cpRotaryLimitJoint { 29 | cpConstraint constraint; 30 | cpFloat min, max; 31 | 32 | cpFloat iSum; 33 | 34 | cpFloat bias; 35 | cpFloat jAcc, jMax; 36 | } cpRotaryLimitJoint; 37 | 38 | /// Allocate a damped rotary limit joint. 39 | cpRotaryLimitJoint* cpRotaryLimitJointAlloc(void); 40 | /// Initialize a damped rotary limit joint. 41 | cpRotaryLimitJoint* cpRotaryLimitJointInit(cpRotaryLimitJoint *joint, cpBody *a, cpBody *b, cpFloat min, cpFloat max); 42 | /// Allocate and initialize a damped rotary limit joint. 43 | cpConstraint* cpRotaryLimitJointNew(cpBody *a, cpBody *b, cpFloat min, cpFloat max); 44 | 45 | CP_DefineConstraintProperty(cpRotaryLimitJoint, cpFloat, min, Min); 46 | CP_DefineConstraintProperty(cpRotaryLimitJoint, cpFloat, max, Max); 47 | 48 | /// @} 49 | -------------------------------------------------------------------------------- /td/libs/Chipmunk/chipmunk/constraints/cpGearJoint.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2007 Scott Lembcke 2 | * 3 | * Permission is hereby granted, free of charge, to any person obtaining a copy 4 | * of this software and associated documentation files (the "Software"), to deal 5 | * in the Software without restriction, including without limitation the rights 6 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | * copies of the Software, and to permit persons to whom the Software is 8 | * furnished to do so, subject to the following conditions: 9 | * 10 | * The above copyright notice and this permission notice shall be included in 11 | * all copies or substantial portions of the Software. 12 | * 13 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 19 | * SOFTWARE. 20 | */ 21 | 22 | /// @defgroup cpGearJoint cpGearJoint 23 | /// @{ 24 | 25 | const cpConstraintClass *cpGearJointGetClass(void); 26 | 27 | /// @private 28 | typedef struct cpGearJoint { 29 | cpConstraint constraint; 30 | cpFloat phase, ratio; 31 | cpFloat ratio_inv; 32 | 33 | cpFloat iSum; 34 | 35 | cpFloat bias; 36 | cpFloat jAcc, jMax; 37 | } cpGearJoint; 38 | 39 | /// Allocate a gear joint. 40 | cpGearJoint* cpGearJointAlloc(void); 41 | /// Initialize a gear joint. 42 | cpGearJoint* cpGearJointInit(cpGearJoint *joint, cpBody *a, cpBody *b, cpFloat phase, cpFloat ratio); 43 | /// Allocate and initialize a gear joint. 44 | cpConstraint* cpGearJointNew(cpBody *a, cpBody *b, cpFloat phase, cpFloat ratio); 45 | 46 | CP_DefineConstraintProperty(cpGearJoint, cpFloat, phase, Phase); 47 | CP_DefineConstraintGetter(cpGearJoint, cpFloat, ratio, Ratio); 48 | /// Set the ratio of a gear joint. 49 | void cpGearJointSetRatio(cpConstraint *constraint, cpFloat value); 50 | 51 | /// @} 52 | -------------------------------------------------------------------------------- /td/libs/Chipmunk/chipmunk/constraints/cpRatchetJoint.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2007 Scott Lembcke 2 | * 3 | * Permission is hereby granted, free of charge, to any person obtaining a copy 4 | * of this software and associated documentation files (the "Software"), to deal 5 | * in the Software without restriction, including without limitation the rights 6 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | * copies of the Software, and to permit persons to whom the Software is 8 | * furnished to do so, subject to the following conditions: 9 | * 10 | * The above copyright notice and this permission notice shall be included in 11 | * all copies or substantial portions of the Software. 12 | * 13 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 19 | * SOFTWARE. 20 | */ 21 | 22 | /// @defgroup cpRatchetJoint cpRatchetJoint 23 | /// @{ 24 | 25 | const cpConstraintClass *cpRatchetJointGetClass(void); 26 | 27 | /// @private 28 | typedef struct cpRatchetJoint { 29 | cpConstraint constraint; 30 | cpFloat angle, phase, ratchet; 31 | 32 | cpFloat iSum; 33 | 34 | cpFloat bias; 35 | cpFloat jAcc, jMax; 36 | } cpRatchetJoint; 37 | 38 | /// Allocate a ratchet joint. 39 | cpRatchetJoint* cpRatchetJointAlloc(void); 40 | /// Initialize a ratched joint. 41 | cpRatchetJoint* cpRatchetJointInit(cpRatchetJoint *joint, cpBody *a, cpBody *b, cpFloat phase, cpFloat ratchet); 42 | /// Allocate and initialize a ratchet joint. 43 | cpConstraint* cpRatchetJointNew(cpBody *a, cpBody *b, cpFloat phase, cpFloat ratchet); 44 | 45 | CP_DefineConstraintProperty(cpRatchetJoint, cpFloat, angle, Angle); 46 | CP_DefineConstraintProperty(cpRatchetJoint, cpFloat, phase, Phase); 47 | CP_DefineConstraintProperty(cpRatchetJoint, cpFloat, ratchet, Ratchet); 48 | 49 | /// @} 50 | -------------------------------------------------------------------------------- /td/libs/Chipmunk/chipmunk/constraints/cpPivotJoint.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2007 Scott Lembcke 2 | * 3 | * Permission is hereby granted, free of charge, to any person obtaining a copy 4 | * of this software and associated documentation files (the "Software"), to deal 5 | * in the Software without restriction, including without limitation the rights 6 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | * copies of the Software, and to permit persons to whom the Software is 8 | * furnished to do so, subject to the following conditions: 9 | * 10 | * The above copyright notice and this permission notice shall be included in 11 | * all copies or substantial portions of the Software. 12 | * 13 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 19 | * SOFTWARE. 20 | */ 21 | 22 | /// @defgroup cpPivotJoint cpPivotJoint 23 | /// @{ 24 | 25 | const cpConstraintClass *cpPivotJointGetClass(void); 26 | 27 | /// @private 28 | typedef struct cpPivotJoint { 29 | cpConstraint constraint; 30 | cpVect anchr1, anchr2; 31 | 32 | cpVect r1, r2; 33 | cpVect k1, k2; 34 | 35 | cpVect jAcc; 36 | cpFloat jMaxLen; 37 | cpVect bias; 38 | } cpPivotJoint; 39 | 40 | /// Allocate a pivot joint 41 | cpPivotJoint* cpPivotJointAlloc(void); 42 | /// Initialize a pivot joint. 43 | cpPivotJoint* cpPivotJointInit(cpPivotJoint *joint, cpBody *a, cpBody *b, cpVect anchr1, cpVect anchr2); 44 | /// Allocate and initialize a pivot joint. 45 | cpConstraint* cpPivotJointNew(cpBody *a, cpBody *b, cpVect pivot); 46 | /// Allocate and initialize a pivot joint with specific anchors. 47 | cpConstraint* cpPivotJointNew2(cpBody *a, cpBody *b, cpVect anchr1, cpVect anchr2); 48 | 49 | CP_DefineConstraintProperty(cpPivotJoint, cpVect, anchr1, Anchr1); 50 | CP_DefineConstraintProperty(cpPivotJoint, cpVect, anchr2, Anchr2); 51 | 52 | /// @} 53 | -------------------------------------------------------------------------------- /td/libs/Chipmunk/cpPolyline.h: -------------------------------------------------------------------------------- 1 | // Polylines are just arrays of vertexes. 2 | // They are looped if the first vertex is equal to the last. 3 | // cpPolyline structs are intended to be passed by value and destroyed when you are done with them. 4 | typedef struct cpPolyline { 5 | int count, capacity; 6 | cpVect *verts; 7 | } cpPolyline; 8 | 9 | /// Destroy a polyline instance. 10 | void cpPolylineDestroy(cpPolyline line); 11 | 12 | // Returns true if the first vertex is equal to the last. 13 | cpBool cpPolylineIsLooped(cpPolyline line); 14 | 15 | /** 16 | Returns a copy of a polyline simplified by using the Douglas-Peucker algorithm. 17 | This works very well on smooth or gently curved shapes, but not well on straight edged or angular shapes. 18 | */ 19 | cpPolyline cpPolylineSimplifyCurves(cpPolyline line, cpFloat tol); 20 | 21 | /** 22 | Returns a copy of a polyline simplified by discarding "flat" vertexes. 23 | This works well on straigt edged or angular shapes, not as well on smooth shapes. 24 | */ 25 | cpPolyline cpPolylineSimplifyVertexes(cpPolyline line, cpFloat tol); 26 | 27 | // Generate a convex hull that contains a polyline. (looped or not) 28 | cpPolyline cpPolylineToConvexHull(cpPolyline line); 29 | 30 | 31 | /// Polyline sets are collections of polylines, generally built by cpMarchSoft() or cpMarchHard(). 32 | typedef struct cpPolylineSet { 33 | int count, capacity; 34 | cpPolyline *lines; 35 | } cpPolylineSet; 36 | 37 | /// Allocate a new polyline set. 38 | cpPolylineSet *cpPolylineSetAlloc(void); 39 | 40 | /// Initialize a new polyline set. 41 | cpPolylineSet *cpPolylineSetInit(cpPolylineSet *set); 42 | 43 | /// Allocate and initialize a polyline set. 44 | cpPolylineSet *cpPolylineSetNew(void); 45 | 46 | /// Destroy a polyline set. 47 | void cpPolylineSetDestroy(cpPolylineSet *set, cpBool freePolylines); 48 | 49 | /// Destroy and free a polyline set. 50 | void cpPolylineSetFree(cpPolylineSet *set, cpBool freePolylines); 51 | 52 | /** 53 | Add a line segment to a polyline set. 54 | A segment will either start a new polyline, join two others, or add to or loop an existing polyline. 55 | This is mostly intended to be used as a callback directly from cpMarchSoft() or cpMarchHard(). 56 | */ 57 | void cpPolylineSetCollectSegment(cpVect v0, cpVect v1, cpPolylineSet *lines); 58 | -------------------------------------------------------------------------------- /td/libs/Chipmunk/chipmunk/constraints/cpSlideJoint.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2007 Scott Lembcke 2 | * 3 | * Permission is hereby granted, free of charge, to any person obtaining a copy 4 | * of this software and associated documentation files (the "Software"), to deal 5 | * in the Software without restriction, including without limitation the rights 6 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | * copies of the Software, and to permit persons to whom the Software is 8 | * furnished to do so, subject to the following conditions: 9 | * 10 | * The above copyright notice and this permission notice shall be included in 11 | * all copies or substantial portions of the Software. 12 | * 13 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 19 | * SOFTWARE. 20 | */ 21 | 22 | /// @defgroup cpSlideJoint cpSlideJoint 23 | /// @{ 24 | 25 | const cpConstraintClass *cpSlideJointGetClass(void); 26 | 27 | /// @private 28 | typedef struct cpSlideJoint { 29 | cpConstraint constraint; 30 | cpVect anchr1, anchr2; 31 | cpFloat min, max; 32 | 33 | cpVect r1, r2; 34 | cpVect n; 35 | cpFloat nMass; 36 | 37 | cpFloat jnAcc, jnMax; 38 | cpFloat bias; 39 | } cpSlideJoint; 40 | 41 | /// Allocate a slide joint. 42 | cpSlideJoint* cpSlideJointAlloc(void); 43 | /// Initialize a slide joint. 44 | cpSlideJoint* cpSlideJointInit(cpSlideJoint *joint, cpBody *a, cpBody *b, cpVect anchr1, cpVect anchr2, cpFloat min, cpFloat max); 45 | /// Allocate and initialize a slide joint. 46 | cpConstraint* cpSlideJointNew(cpBody *a, cpBody *b, cpVect anchr1, cpVect anchr2, cpFloat min, cpFloat max); 47 | 48 | CP_DefineConstraintProperty(cpSlideJoint, cpVect, anchr1, Anchr1); 49 | CP_DefineConstraintProperty(cpSlideJoint, cpVect, anchr2, Anchr2); 50 | CP_DefineConstraintProperty(cpSlideJoint, cpFloat, min, Min); 51 | CP_DefineConstraintProperty(cpSlideJoint, cpFloat, max, Max); 52 | 53 | /// @} 54 | -------------------------------------------------------------------------------- /td/libs/cocos2d/Support/CCFileUtils.h: -------------------------------------------------------------------------------- 1 | /* 2 | * cocos2d for iPhone: http://www.cocos2d-iphone.org 3 | * 4 | * Copyright (c) 2008-2010 Ricardo Quesada 5 | * Copyright (c) 2011 Zynga Inc. 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 29 | 30 | 31 | /** Helper class to handle file operations */ 32 | @interface CCFileUtils : NSObject 33 | { 34 | } 35 | 36 | /** Returns the fullpath of an filename. 37 | 38 | If this method is when Retina Display is enabled, then the 39 | Retina Display suffix will be appended to the file (See ccConfig.h). 40 | 41 | If the Retina Display image doesn't exist, then it will return the "non-Retina Display" image 42 | 43 | */ 44 | +(NSString*) fullPathFromRelativePath:(NSString*) relPath; 45 | @end 46 | 47 | /** loads a file into memory. 48 | the caller should release the allocated buffer. 49 | 50 | @returns the size of the allocated buffer 51 | @since v0.99.5 52 | */ 53 | NSInteger ccLoadFileIntoMemory(const char *filename, unsigned char **out); 54 | 55 | 56 | /** removes the HD suffix from a path 57 | 58 | @returns NSString * without the HD suffix 59 | @since v0.99.5 60 | */ 61 | NSString *ccRemoveHDSuffixFromFile( NSString *path ); 62 | 63 | -------------------------------------------------------------------------------- /td/libs/cocos2d/Platforms/iOS/ESRenderer.h: -------------------------------------------------------------------------------- 1 | /* 2 | * cocos2d for iPhone: http://www.cocos2d-iphone.org 3 | * 4 | * Copyright (c) 2010 Ricardo Quesada 5 | * Copyright (c) 2011 Zynga Inc. 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 | * File autogenerated with Xcode. Adapted for cocos2d needs. 27 | */ 28 | 29 | // Only compile this code on iOS. These files should NOT be included on your Mac project. 30 | // But in case they are included, it won't be compiled. 31 | #import 32 | #ifdef __IPHONE_OS_VERSION_MAX_ALLOWED 33 | 34 | #import 35 | 36 | #import 37 | #import 38 | 39 | @protocol ESRenderer 40 | 41 | - (id) initWithDepthFormat:(unsigned int)depthFormat withPixelFormat:(unsigned int)pixelFormat withSharegroup:(EAGLSharegroup*)sharegroup withMultiSampling:(BOOL) multiSampling withNumberOfSamples:(unsigned int) requestedSamples; 42 | 43 | - (BOOL) resizeFromLayer:(CAEAGLLayer *)layer; 44 | 45 | - (EAGLContext*) context; 46 | - (CGSize) backingSize; 47 | 48 | - (unsigned int) colorRenderBuffer; 49 | - (unsigned int) defaultFrameBuffer; 50 | - (unsigned int) msaaFrameBuffer; 51 | - (unsigned int) msaaColorBuffer; 52 | @end 53 | 54 | #endif // __IPHONE_OS_VERSION_MAX_ALLOWED 55 | -------------------------------------------------------------------------------- /td/pgeTerrain.h: -------------------------------------------------------------------------------- 1 | // 2 | // pgeTerrain.h 3 | // terrainDemo 4 | // 5 | // Created by Lars Birkemose on 03/02/12. 6 | // Copyright 2012 Protec Electronics. All rights reserved. 7 | // 8 | // ---------------------------------------------------------- 9 | // import headers 10 | 11 | #import "GameConfig.h" 12 | #import 13 | #import "cocos2d.h" 14 | #import "ObjectiveChipmunk.h" 15 | #import "ChipmunkImageSampler.h" 16 | 17 | // ---------------------------------------------------------- 18 | // defines 19 | 20 | #define TERRAIN_TILE_SIZE 64 // a good number to use 21 | #define TERRAIN_PIXEL_SIZE 2 // scale from terrain image to output 22 | 23 | #define TERRAIN_THICKNESS 1.0f // thickness of terrain segments 24 | #define TERRAIN_GEOMETRY_REDUCTION 1.5f // geometry reduction ( for smoother output ) 25 | 26 | #define IS_TERRAIN( color ) ( color < 128 ) // dark is terrain 27 | 28 | // ---------------------------------------------------------- 29 | // typedefs 30 | 31 | // ---------------------------------------------------------- 32 | // interface 33 | 34 | @interface pgeTerrain : CCNode { 35 | ChipmunkSpace* m_space; // the chipmunk space 36 | ChipmunkCGContextSampler* m_sampler; // image sampler 37 | ChipmunkBasicTileCache* m_cache; // terrain cache 38 | CGSize m_size; // size of terrain image 39 | CGSize m_winSize; // window size 40 | CCTexture2D* m_texture; 41 | } 42 | 43 | // ---------------------------------------------------------- 44 | // properties 45 | 46 | @property ( readonly ) CGSize size; 47 | 48 | // ---------------------------------------------------------- 49 | // methods 50 | 51 | +( pgeTerrain* )terrainWithSpace:( ChipmunkSpace* )space andImage:( NSString* )filename; 52 | -( pgeTerrain* )initWithSpace:( ChipmunkSpace* )space andImage:( NSString* )filename; 53 | 54 | -( BOOL )pointInsideTerrain:( CGPoint )pos; 55 | 56 | -( void )add:( CGPoint )pos withDiameter:( float )diameter; 57 | -( void )remove:( CGPoint )pos withDiameter:( float )diameter; 58 | 59 | // ---------------------------------------------------------- 60 | 61 | @end 62 | -------------------------------------------------------------------------------- /td/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 | -------------------------------------------------------------------------------- /td/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 | -------------------------------------------------------------------------------- /td/libs/cocos2d/CCParticleSystemPoint.h: -------------------------------------------------------------------------------- 1 | /* 2 | * cocos2d for iPhone: http://www.cocos2d-iphone.org 3 | * 4 | * Copyright (c) 2008-2010 Ricardo Quesada 5 | * Copyright (c) 2011 Zynga Inc. 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 29 | #import "CCParticleSystem.h" 30 | 31 | #define CC_MAX_PARTICLE_SIZE 64 32 | 33 | #ifdef __IPHONE_OS_VERSION_MAX_ALLOWED 34 | 35 | /** CCParticleSystemPoint is a subclass of CCParticleSystem 36 | Attributes of a Particle System: 37 | * All the attributes of Particle System 38 | 39 | Features: 40 | * consumes small memory: uses 1 vertex (x,y) per particle, no need to assign tex coordinates 41 | * size can't be bigger than 64 42 | * the system can't be scaled since the particles are rendered using GL_POINT_SPRITE 43 | 44 | Limitations: 45 | * On 3rd gen iPhone devices and iPads, this node performs MUCH slower than CCParticleSystemQuad. 46 | */ 47 | @interface CCParticleSystemPoint : CCParticleSystem 48 | { 49 | // Array of (x,y,size) 50 | ccPointSprite *vertices; 51 | // vertices buffer id 52 | #if CC_USES_VBO 53 | GLuint verticesID; 54 | #endif 55 | } 56 | @end 57 | 58 | #elif __MAC_OS_X_VERSION_MAX_ALLOWED 59 | 60 | #import "CCParticleSystemQuad.h" 61 | 62 | @interface CCParticleSystemPoint : CCParticleSystemQuad 63 | @end 64 | 65 | #endif 66 | -------------------------------------------------------------------------------- /td/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 | -------------------------------------------------------------------------------- /td/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 | -------------------------------------------------------------------------------- /td/libs/Chipmunk/chipmunk/constraints/cpGrooveJoint.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2007 Scott Lembcke 2 | * 3 | * Permission is hereby granted, free of charge, to any person obtaining a copy 4 | * of this software and associated documentation files (the "Software"), to deal 5 | * in the Software without restriction, including without limitation the rights 6 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | * copies of the Software, and to permit persons to whom the Software is 8 | * furnished to do so, subject to the following conditions: 9 | * 10 | * The above copyright notice and this permission notice shall be included in 11 | * all copies or substantial portions of the Software. 12 | * 13 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 19 | * SOFTWARE. 20 | */ 21 | 22 | /// @defgroup cpGrooveJoint cpGrooveJoint 23 | /// @{ 24 | 25 | const cpConstraintClass *cpGrooveJointGetClass(void); 26 | 27 | /// @private 28 | typedef struct cpGrooveJoint { 29 | cpConstraint constraint; 30 | cpVect grv_n, grv_a, grv_b; 31 | cpVect anchr2; 32 | 33 | cpVect grv_tn; 34 | cpFloat clamp; 35 | cpVect r1, r2; 36 | cpVect k1, k2; 37 | 38 | cpVect jAcc; 39 | cpFloat jMaxLen; 40 | cpVect bias; 41 | } cpGrooveJoint; 42 | 43 | /// Allocate a groove joint. 44 | cpGrooveJoint* cpGrooveJointAlloc(void); 45 | /// Initialize a groove joint. 46 | cpGrooveJoint* cpGrooveJointInit(cpGrooveJoint *joint, cpBody *a, cpBody *b, cpVect groove_a, cpVect groove_b, cpVect anchr2); 47 | /// Allocate and initialize a groove joint. 48 | cpConstraint* cpGrooveJointNew(cpBody *a, cpBody *b, cpVect groove_a, cpVect groove_b, cpVect anchr2); 49 | 50 | CP_DefineConstraintGetter(cpGrooveJoint, cpVect, grv_a, GrooveA); 51 | /// Set endpoint a of a groove joint's groove 52 | void cpGrooveJointSetGrooveA(cpConstraint *constraint, cpVect value); 53 | CP_DefineConstraintGetter(cpGrooveJoint, cpVect, grv_b, GrooveB); 54 | /// Set endpoint b of a groove joint's groove 55 | void cpGrooveJointSetGrooveB(cpConstraint *constraint, cpVect value); 56 | CP_DefineConstraintProperty(cpGrooveJoint, cpVect, anchr2, Anchr2); 57 | 58 | /// @} 59 | -------------------------------------------------------------------------------- /td/libs/cocos2d/CCAnimationCache.h: -------------------------------------------------------------------------------- 1 | /* 2 | * cocos2d for iPhone: http://www.cocos2d-iphone.org 3 | * 4 | * Copyright (c) 2010 Ricardo Quesada 5 | * Copyright (c) 2011 Zynga Inc. 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 | #import 28 | 29 | @class CCAnimation; 30 | 31 | /** Singleton that manages the Animations. 32 | It saves in a cache the animations. You should use this class if you want to save your animations in a cache. 33 | 34 | Before v0.99.5, the recommend way was to save them on the CCSprite. Since v0.99.5, you should use this class instead. 35 | 36 | @since v0.99.5 37 | */ 38 | @interface CCAnimationCache : NSObject 39 | { 40 | NSMutableDictionary *animations_; 41 | } 42 | 43 | /** Retruns ths shared instance of the Animation cache */ 44 | + (CCAnimationCache *) sharedAnimationCache; 45 | 46 | /** Purges the cache. It releases all the CCAnimation objects and the shared instance. 47 | */ 48 | +(void)purgeSharedAnimationCache; 49 | 50 | /** Adds a CCAnimation with a name. 51 | */ 52 | -(void) addAnimation:(CCAnimation*)animation name:(NSString*)name; 53 | 54 | /** Deletes a CCAnimation from the cache. 55 | */ 56 | -(void) removeAnimationByName:(NSString*)name; 57 | 58 | /** Returns a CCAnimation that was previously added. 59 | If the name is not found it will return nil. 60 | You should retain the returned copy if you are going to use it. 61 | */ 62 | -(CCAnimation*) animationByName:(NSString*)name; 63 | 64 | @end 65 | -------------------------------------------------------------------------------- /td/libs/cocos2d/CCTMXObjectGroup.h: -------------------------------------------------------------------------------- 1 | /* 2 | * cocos2d for iPhone: http://www.cocos2d-iphone.org 3 | * 4 | * Copyright (c) 2010 Neophit 5 | * 6 | * Copyright (c) 2010 Ricardo Quesada 7 | * Copyright (c) 2011 Zynga Inc. 8 | * 9 | * Permission is hereby granted, free of charge, to any person obtaining a copy 10 | * of this software and associated documentation files (the "Software"), to deal 11 | * in the Software without restriction, including without limitation the rights 12 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | * copies of the Software, and to permit persons to whom the Software is 14 | * furnished to do so, subject to the following conditions: 15 | * 16 | * The above copyright notice and this permission notice shall be included in 17 | * all copies or substantial portions of the Software. 18 | * 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | * THE SOFTWARE. 26 | * 27 | * 28 | * TMX Tiled Map support: 29 | * http://www.mapeditor.org 30 | * 31 | */ 32 | 33 | #import "CCNode.h" 34 | 35 | 36 | @class CCTMXObjectGroup; 37 | 38 | 39 | /** CCTMXObjectGroup represents the TMX object group. 40 | @since v0.99.0 41 | */ 42 | @interface CCTMXObjectGroup : NSObject 43 | { 44 | NSString *groupName_; 45 | CGPoint positionOffset_; 46 | NSMutableArray *objects_; 47 | NSMutableDictionary *properties_; 48 | } 49 | 50 | /** name of the group */ 51 | @property (nonatomic,readwrite,retain) NSString *groupName; 52 | /** offset position of child objects */ 53 | @property (nonatomic,readwrite,assign) CGPoint positionOffset; 54 | /** array of the objects */ 55 | @property (nonatomic,readwrite,retain) NSMutableArray *objects; 56 | /** list of properties stored in a dictionary */ 57 | @property (nonatomic,readwrite,retain) NSMutableDictionary *properties; 58 | 59 | /** return the value for the specific property name */ 60 | -(id) propertyNamed:(NSString *)propertyName; 61 | 62 | /** return the dictionary for the specific object name. 63 | It will return the 1st object found on the array for the given name. 64 | */ 65 | -(NSMutableDictionary*) objectNamed:(NSString *)objectName; 66 | 67 | @end 68 | -------------------------------------------------------------------------------- /td/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 | -------------------------------------------------------------------------------- /td/libs/cocos2d/Platforms/iOS/ES1Renderer.h: -------------------------------------------------------------------------------- 1 | /* 2 | * cocos2d for iPhone: http://www.cocos2d-iphone.org 3 | * 4 | * Copyright (c) 2010 Ricardo Quesada 5 | * Copyright (c) 2011 Zynga Inc. 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 | * File autogenerated with Xcode. Adapted for cocos2d needs. 27 | */ 28 | 29 | // Only compile this code on iOS. These files should NOT be included on your Mac project. 30 | // But in case they are included, it won't be compiled. 31 | #import 32 | #ifdef __IPHONE_OS_VERSION_MAX_ALLOWED 33 | 34 | 35 | #import "ESRenderer.h" 36 | 37 | #import 38 | #import 39 | 40 | @interface ES1Renderer : NSObject 41 | { 42 | // The pixel dimensions of the CAEAGLLayer 43 | GLint backingWidth_; 44 | GLint backingHeight_; 45 | 46 | unsigned int samplesToUse_; 47 | BOOL multiSampling_; 48 | 49 | unsigned int depthFormat_; 50 | unsigned int pixelFormat_; 51 | 52 | // The OpenGL ES names for the framebuffer and renderbuffer used to render to this view 53 | GLuint defaultFramebuffer_; 54 | GLuint colorRenderbuffer_; 55 | GLuint depthBuffer_; 56 | 57 | 58 | //buffers for MSAA 59 | GLuint msaaFramebuffer_; 60 | GLuint msaaColorbuffer_; 61 | 62 | EAGLContext *context_; 63 | } 64 | 65 | /** EAGLContext */ 66 | @property (nonatomic,readonly) EAGLContext* context; 67 | 68 | - (BOOL)resizeFromLayer:(CAEAGLLayer *)layer; 69 | 70 | @end 71 | 72 | #endif // __IPHONE_OS_VERSION_MAX_ALLOWED 73 | -------------------------------------------------------------------------------- /td/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 | -------------------------------------------------------------------------------- /td/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 | * It will allocate 256k for the destination buffer. If it is not enought it will multiply the previous buffer size per 2, until there is enough memory. 51 | * @returns the length of the deflated buffer 52 | * 53 | @since v0.8.1 54 | */ 55 | int ccInflateMemory(unsigned char *in, unsigned int inLength, unsigned char **out); 56 | 57 | /** 58 | * Inflates either zlib or gzip deflated memory. The inflated memory is 59 | * expected to be freed by the caller. 60 | * 61 | * outLenghtHint is assumed to be the needed room to allocate the inflated buffer. 62 | * 63 | * @returns the length of the deflated buffer 64 | * 65 | @since v1.0.0 66 | */ 67 | int ccInflateMemoryWithHint(unsigned char *in, unsigned int inLength, unsigned char **out, unsigned int outLenghtHint ); 68 | 69 | 70 | /** inflates a GZip file into memory 71 | * 72 | * @returns the length of the deflated buffer 73 | * 74 | * @since v0.99.5 75 | */ 76 | int ccInflateGZipFile(const char *filename, unsigned char **out); 77 | 78 | /** inflates a CCZ file into memory 79 | * 80 | * @returns the length of the deflated buffer 81 | * 82 | * @since v0.99.5 83 | */ 84 | int ccInflateCCZFile(const char *filename, unsigned char **out); 85 | 86 | 87 | #ifdef __cplusplus 88 | } 89 | #endif 90 | 91 | #endif // __CC_ZIP_UTILS_H 92 | -------------------------------------------------------------------------------- /td/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 | #include "base64.h" 11 | 12 | unsigned char alphabet[64] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; 13 | 14 | int _base64Decode( unsigned char *input, unsigned int input_len, unsigned char *output, unsigned int *output_len ); 15 | 16 | int _base64Decode( unsigned char *input, unsigned int input_len, unsigned char *output, unsigned int *output_len ) 17 | { 18 | static char inalphabet[256], decoder[256]; 19 | int i, bits, c, char_count, errors = 0; 20 | unsigned int input_idx = 0; 21 | unsigned int output_idx = 0; 22 | 23 | for (i = (sizeof alphabet) - 1; i >= 0 ; i--) { 24 | inalphabet[alphabet[i]] = 1; 25 | decoder[alphabet[i]] = i; 26 | } 27 | 28 | char_count = 0; 29 | bits = 0; 30 | for( input_idx=0; input_idx < input_len ; input_idx++ ) { 31 | c = input[ input_idx ]; 32 | if (c == '=') 33 | break; 34 | if (c > 255 || ! inalphabet[c]) 35 | continue; 36 | bits += decoder[c]; 37 | char_count++; 38 | if (char_count == 4) { 39 | output[ output_idx++ ] = (bits >> 16); 40 | output[ output_idx++ ] = ((bits >> 8) & 0xff); 41 | output[ output_idx++ ] = ( bits & 0xff); 42 | bits = 0; 43 | char_count = 0; 44 | } else { 45 | bits <<= 6; 46 | } 47 | } 48 | 49 | if( c == '=' ) { 50 | switch (char_count) { 51 | case 1: 52 | fprintf(stderr, "base64Decode: encoding incomplete: at least 2 bits missing"); 53 | errors++; 54 | break; 55 | case 2: 56 | output[ output_idx++ ] = ( bits >> 10 ); 57 | break; 58 | case 3: 59 | output[ output_idx++ ] = ( bits >> 16 ); 60 | output[ output_idx++ ] = (( bits >> 8 ) & 0xff); 61 | break; 62 | } 63 | } else if ( input_idx < input_len ) { 64 | if (char_count) { 65 | fprintf(stderr, "base64 encoding incomplete: at least %d bits truncated", 66 | ((4 - char_count) * 6)); 67 | errors++; 68 | } 69 | } 70 | 71 | *output_len = output_idx; 72 | return errors; 73 | } 74 | 75 | int base64Decode(unsigned char *in, unsigned int inLength, unsigned char **out) 76 | { 77 | unsigned int outLength = 0; 78 | 79 | //should be enough to store 6-bit buffers in 8-bit buffers 80 | *out = malloc( inLength * 3.0f / 4.0f + 1 ); 81 | if( *out ) { 82 | int ret = _base64Decode(in, inLength, *out, &outLength); 83 | 84 | if (ret > 0 ) 85 | { 86 | printf("Base64Utils: error decoding"); 87 | free(*out); 88 | *out = NULL; 89 | outLength = 0; 90 | } 91 | } 92 | return outLength; 93 | } 94 | -------------------------------------------------------------------------------- /td/libs/Chipmunk/chipmunk/constraints/cpDampedRotarySpring.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2007 Scott Lembcke 2 | * 3 | * Permission is hereby granted, free of charge, to any person obtaining a copy 4 | * of this software and associated documentation files (the "Software"), to deal 5 | * in the Software without restriction, including without limitation the rights 6 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | * copies of the Software, and to permit persons to whom the Software is 8 | * furnished to do so, subject to the following conditions: 9 | * 10 | * The above copyright notice and this permission notice shall be included in 11 | * all copies or substantial portions of the Software. 12 | * 13 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 19 | * SOFTWARE. 20 | */ 21 | 22 | /// @defgroup cpDampedRotarySpring cpDampedRotarySpring 23 | /// @{ 24 | 25 | typedef cpFloat (*cpDampedRotarySpringTorqueFunc)(struct cpConstraint *spring, cpFloat relativeAngle); 26 | 27 | const cpConstraintClass *cpDampedRotarySpringGetClass(void); 28 | 29 | /// @private 30 | typedef struct cpDampedRotarySpring { 31 | cpConstraint constraint; 32 | cpFloat restAngle; 33 | cpFloat stiffness; 34 | cpFloat damping; 35 | cpDampedRotarySpringTorqueFunc springTorqueFunc; 36 | 37 | cpFloat target_wrn; 38 | cpFloat w_coef; 39 | 40 | cpFloat iSum; 41 | } cpDampedRotarySpring; 42 | 43 | /// Allocate a damped rotary spring. 44 | cpDampedRotarySpring* cpDampedRotarySpringAlloc(void); 45 | /// Initialize a damped rotary spring. 46 | cpDampedRotarySpring* cpDampedRotarySpringInit(cpDampedRotarySpring *joint, cpBody *a, cpBody *b, cpFloat restAngle, cpFloat stiffness, cpFloat damping); 47 | /// Allocate and initialize a damped rotary spring. 48 | cpConstraint* cpDampedRotarySpringNew(cpBody *a, cpBody *b, cpFloat restAngle, cpFloat stiffness, cpFloat damping); 49 | 50 | CP_DefineConstraintProperty(cpDampedRotarySpring, cpFloat, restAngle, RestAngle); 51 | CP_DefineConstraintProperty(cpDampedRotarySpring, cpFloat, stiffness, Stiffness); 52 | CP_DefineConstraintProperty(cpDampedRotarySpring, cpFloat, damping, Damping); 53 | CP_DefineConstraintProperty(cpDampedRotarySpring, cpDampedRotarySpringTorqueFunc, springTorqueFunc, SpringTorqueFunc); 54 | 55 | /// @} 56 | -------------------------------------------------------------------------------- /td/libs/cocos2d/CCTMXObjectGroup.m: -------------------------------------------------------------------------------- 1 | /* 2 | * cocos2d for iPhone: http://www.cocos2d-iphone.org 3 | * 4 | * Copyright (c) 2010 Neophit 5 | * 6 | * Copyright (c) 2010 Ricardo Quesada 7 | * Copyright (c) 2011 Zynga Inc. 8 | * 9 | * Permission is hereby granted, free of charge, to any person obtaining a copy 10 | * of this software and associated documentation files (the "Software"), to deal 11 | * in the Software without restriction, including without limitation the rights 12 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | * copies of the Software, and to permit persons to whom the Software is 14 | * furnished to do so, subject to the following conditions: 15 | * 16 | * The above copyright notice and this permission notice shall be included in 17 | * all copies or substantial portions of the Software. 18 | * 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | * THE SOFTWARE. 26 | * 27 | * 28 | * TMX Tiled Map support: 29 | * http://www.mapeditor.org 30 | * 31 | */ 32 | 33 | #import "CCTMXObjectGroup.h" 34 | #import "CCTMXXMLParser.h" 35 | #import "ccMacros.h" 36 | #import "Support/CGPointExtension.h" 37 | 38 | 39 | #pragma mark - 40 | #pragma mark TMXObjectGroup 41 | 42 | @implementation CCTMXObjectGroup 43 | 44 | @synthesize groupName = groupName_; 45 | @synthesize objects = objects_; 46 | @synthesize positionOffset = positionOffset_; 47 | @synthesize properties = properties_; 48 | 49 | -(id) init 50 | { 51 | if (( self=[super init] )) { 52 | self.groupName = nil; 53 | self.positionOffset = CGPointZero; 54 | self.objects = [NSMutableArray arrayWithCapacity:10]; 55 | self.properties = [NSMutableDictionary dictionaryWithCapacity:5]; 56 | } 57 | return self; 58 | } 59 | 60 | -(void) dealloc 61 | { 62 | CCLOGINFO( @"cocos2d: deallocing %@", self ); 63 | 64 | [groupName_ release]; 65 | [objects_ release]; 66 | [properties_ release]; 67 | [super dealloc]; 68 | } 69 | 70 | -(NSMutableDictionary*) objectNamed:(NSString *)objectName 71 | { 72 | for( id object in objects_ ) { 73 | if( [[object valueForKey:@"name"] isEqual:objectName] ) 74 | return object; 75 | } 76 | 77 | // object not found 78 | return nil; 79 | } 80 | 81 | -(id) propertyNamed:(NSString *)propertyName 82 | { 83 | return [properties_ valueForKey:propertyName]; 84 | } 85 | 86 | @end 87 | -------------------------------------------------------------------------------- /td/libs/cocos2d/CCLabelAtlas.h: -------------------------------------------------------------------------------- 1 | /* 2 | * cocos2d for iPhone: http://www.cocos2d-iphone.org 3 | * 4 | * Copyright (c) 2008-2010 Ricardo Quesada 5 | * Copyright (c) 2011 Zynga Inc. 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 "CCAtlasNode.h" 29 | #import "CCTextureAtlas.h" 30 | 31 | /** CCLabelAtlas is a subclass of CCAtlasNode. 32 | 33 | It can be as a replacement of CCLabel since it is MUCH faster. 34 | 35 | CCLabelAtlas versus CCLabel: 36 | - CCLabelAtlas is MUCH faster than CCLabel 37 | - CCLabelAtlas "characters" have a fixed height and width 38 | - CCLabelAtlas "characters" can be anything you want since they are taken from an image file 39 | 40 | A more flexible class is CCLabelBMFont. It supports variable width characters and it also has a nice editor. 41 | */ 42 | @interface CCLabelAtlas : CCAtlasNode 43 | { 44 | // string to render 45 | NSString *string_; 46 | 47 | // the first char in the charmap 48 | unsigned char mapStartChar_; 49 | } 50 | 51 | 52 | /** 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 */ 53 | +(id) labelWithString:(NSString*) string charMapFile: (NSString*) charmapfile itemWidth:(NSUInteger)w itemHeight:(NSUInteger)h startCharMap:(unsigned char)c; 54 | 55 | /** 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 */ 56 | -(id) initWithString:(NSString*) string charMapFile: (NSString*) charmapfile itemWidth:(NSUInteger)w itemHeight:(NSUInteger)h startCharMap:(unsigned char)c; 57 | @end 58 | -------------------------------------------------------------------------------- /td/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 | -------------------------------------------------------------------------------- /td/libs/cocos2d/CCActionCamera.h: -------------------------------------------------------------------------------- 1 | /* 2 | * cocos2d for iPhone: http://www.cocos2d-iphone.org 3 | * 4 | * Copyright (c) 2008-2010 Ricardo Quesada 5 | * Copyright (c) 2011 Zynga Inc. 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 | #import "CCActionInterval.h" 28 | 29 | @class CCCamera; 30 | 31 | /** Base class for CCCamera actions 32 | */ 33 | @interface CCActionCamera : CCActionInterval 34 | { 35 | float centerXOrig_; 36 | float centerYOrig_; 37 | float centerZOrig_; 38 | 39 | float eyeXOrig_; 40 | float eyeYOrig_; 41 | float eyeZOrig_; 42 | 43 | float upXOrig_; 44 | float upYOrig_; 45 | float upZOrig_; 46 | } 47 | @end 48 | 49 | /** CCOrbitCamera action 50 | Orbits the camera around the center of the screen using spherical coordinates 51 | */ 52 | @interface CCOrbitCamera : CCActionCamera 53 | { 54 | float radius_; 55 | float deltaRadius_; 56 | float angleZ_; 57 | float deltaAngleZ_; 58 | float angleX_; 59 | float deltaAngleX_; 60 | 61 | float radZ_; 62 | float radDeltaZ_; 63 | float radX_; 64 | float radDeltaX_; 65 | 66 | } 67 | /** creates a CCOrbitCamera action with radius, delta-radius, z, deltaZ, x, deltaX */ 68 | +(id) actionWithDuration:(float) t radius:(float)r deltaRadius:(float) dr angleZ:(float)z deltaAngleZ:(float)dz angleX:(float)x deltaAngleX:(float)dx; 69 | /** initializes a CCOrbitCamera action with radius, delta-radius, z, deltaZ, x, deltaX */ 70 | -(id) initWithDuration:(float) t radius:(float)r deltaRadius:(float) dr angleZ:(float)z deltaAngleZ:(float)dz angleX:(float)x deltaAngleX:(float)dx; 71 | /** positions the camera according to spherical coordinates */ 72 | -(void) sphericalRadius:(float*) r zenith:(float*) zenith azimuth:(float*) azimuth; 73 | @end 74 | -------------------------------------------------------------------------------- /td/libs/Chipmunk/chipmunk/constraints/cpDampedSpring.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2007 Scott Lembcke 2 | * 3 | * Permission is hereby granted, free of charge, to any person obtaining a copy 4 | * of this software and associated documentation files (the "Software"), to deal 5 | * in the Software without restriction, including without limitation the rights 6 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | * copies of the Software, and to permit persons to whom the Software is 8 | * furnished to do so, subject to the following conditions: 9 | * 10 | * The above copyright notice and this permission notice shall be included in 11 | * all copies or substantial portions of the Software. 12 | * 13 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 19 | * SOFTWARE. 20 | */ 21 | 22 | /// @defgroup cpDampedSpring cpDampedSpring 23 | /// @{ 24 | 25 | typedef struct cpDampedSpring cpDampedSpring; 26 | 27 | typedef cpFloat (*cpDampedSpringForceFunc)(cpConstraint *spring, cpFloat dist); 28 | 29 | const cpConstraintClass *cpDampedSpringGetClass(void); 30 | 31 | /// @private 32 | struct cpDampedSpring { 33 | cpConstraint constraint; 34 | cpVect anchr1, anchr2; 35 | cpFloat restLength; 36 | cpFloat stiffness; 37 | cpFloat damping; 38 | cpDampedSpringForceFunc springForceFunc; 39 | 40 | cpFloat target_vrn; 41 | cpFloat v_coef; 42 | 43 | cpVect r1, r2; 44 | cpFloat nMass; 45 | cpVect n; 46 | }; 47 | 48 | /// Allocate a damped spring. 49 | cpDampedSpring* cpDampedSpringAlloc(void); 50 | /// Initialize a damped spring. 51 | cpDampedSpring* cpDampedSpringInit(cpDampedSpring *joint, cpBody *a, cpBody *b, cpVect anchr1, cpVect anchr2, cpFloat restLength, cpFloat stiffness, cpFloat damping); 52 | /// Allocate and initialize a damped spring. 53 | cpConstraint* cpDampedSpringNew(cpBody *a, cpBody *b, cpVect anchr1, cpVect anchr2, cpFloat restLength, cpFloat stiffness, cpFloat damping); 54 | 55 | CP_DefineConstraintProperty(cpDampedSpring, cpVect, anchr1, Anchr1); 56 | CP_DefineConstraintProperty(cpDampedSpring, cpVect, anchr2, Anchr2); 57 | CP_DefineConstraintProperty(cpDampedSpring, cpFloat, restLength, RestLength); 58 | CP_DefineConstraintProperty(cpDampedSpring, cpFloat, stiffness, Stiffness); 59 | CP_DefineConstraintProperty(cpDampedSpring, cpFloat, damping, Damping); 60 | CP_DefineConstraintProperty(cpDampedSpring, cpDampedSpringForceFunc, springForceFunc, SpringForceFunc); 61 | 62 | /// @} 63 | -------------------------------------------------------------------------------- /td/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 | -------------------------------------------------------------------------------- /td/libs/cocos2d/CCParticleSystemQuad.h: -------------------------------------------------------------------------------- 1 | /* 2 | * cocos2d for iPhone: http://www.cocos2d-iphone.org 3 | * 4 | * Copyright (c) 2009 Leonardo Kasperavičius 5 | * 6 | * Copyright (c) 2008-2010 Ricardo Quesada 7 | * Copyright (c) 2011 Zynga Inc. 8 | * 9 | * Permission is hereby granted, free of charge, to any person obtaining a copy 10 | * of this software and associated documentation files (the "Software"), to deal 11 | * in the Software without restriction, including without limitation the rights 12 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | * copies of the Software, and to permit persons to whom the Software is 14 | * furnished to do so, subject to the following conditions: 15 | * 16 | * The above copyright notice and this permission notice shall be included in 17 | * all copies or substantial portions of the Software. 18 | * 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | * THE SOFTWARE. 26 | * 27 | */ 28 | 29 | 30 | #import "CCParticleSystem.h" 31 | #import "ccConfig.h" 32 | 33 | @class CCSpriteFrame; 34 | 35 | /** CCParticleSystemQuad is a subclass of CCParticleSystem 36 | 37 | It includes all the features of ParticleSystem. 38 | 39 | Special features and Limitations: 40 | - Particle size can be any float number. 41 | - The system can be scaled 42 | - The particles can be rotated 43 | - On 1st and 2nd gen iPhones: It is only a bit slower that CCParticleSystemPoint 44 | - On 3rd gen iPhone and iPads: It is MUCH faster than CCParticleSystemPoint 45 | - It consumes more RAM and more GPU memory than CCParticleSystemPoint 46 | - It supports subrects 47 | @since v0.8 48 | */ 49 | @interface CCParticleSystemQuad : CCParticleSystem 50 | { 51 | ccV2F_C4B_T2F_Quad *quads_; // quads to be rendered 52 | GLushort *indices_; // indices 53 | #if CC_USES_VBO 54 | GLuint quadsID_; // VBO id 55 | #endif 56 | } 57 | 58 | /** initialices the indices for the vertices */ 59 | -(void) initIndices; 60 | 61 | /** initilizes the texture with a rectangle measured Points */ 62 | -(void) initTexCoordsWithRect:(CGRect)rect; 63 | 64 | /** Sets a new CCSpriteFrame as particle. 65 | WARNING: this method is experimental. Use setTexture:withRect instead. 66 | @since v0.99.4 67 | */ 68 | -(void)setDisplayFrame:(CCSpriteFrame*)spriteFrame; 69 | 70 | /** Sets a new texture with a rect. The rect is in Points. 71 | @since v0.99.4 72 | */ 73 | -(void) setTexture:(CCTexture2D *)texture withRect:(CGRect)rect; 74 | 75 | @end 76 | 77 | -------------------------------------------------------------------------------- /td/libs/Chipmunk/chipmunk/chipmunk_unsafe.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2007 Scott Lembcke 2 | * 3 | * Permission is hereby granted, free of charge, to any person obtaining a copy 4 | * of this software and associated documentation files (the "Software"), to deal 5 | * in the Software without restriction, including without limitation the rights 6 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | * copies of the Software, and to permit persons to whom the Software is 8 | * furnished to do so, subject to the following conditions: 9 | * 10 | * The above copyright notice and this permission notice shall be included in 11 | * all copies or substantial portions of the Software. 12 | * 13 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 19 | * SOFTWARE. 20 | */ 21 | 22 | /* This header defines a number of "unsafe" operations on Chipmunk objects. 23 | * In this case "unsafe" is referring to operations which may reduce the 24 | * physical accuracy or numerical stability of the simulation, but will not 25 | * cause crashes. 26 | * 27 | * The prime example is mutating collision shapes. Chipmunk does not support 28 | * this directly. Mutating shapes using this API will caused objects in contact 29 | * to be pushed apart using Chipmunk's overlap solver, but not using real 30 | * persistent velocities. Probably not what you meant, but perhaps close enough. 31 | */ 32 | 33 | /// @defgroup unsafe Chipmunk Unsafe Shape Operations 34 | /// These functions are used for mutating collision shapes. 35 | /// Chipmunk does not have any way to get velocity information on changing shapes, 36 | /// so the results will be unrealistic. You must explicity include the chipmunk_unsafe.h header to use them. 37 | /// @{ 38 | 39 | #ifndef CHIPMUNK_UNSAFE_HEADER 40 | #define CHIPMUNK_UNSAFE_HEADER 41 | 42 | #ifdef __cplusplus 43 | extern "C" { 44 | #endif 45 | 46 | /// Set the radius of a circle shape. 47 | void cpCircleShapeSetRadius(cpShape *shape, cpFloat radius); 48 | /// Set the offset of a circle shape. 49 | void cpCircleShapeSetOffset(cpShape *shape, cpVect offset); 50 | 51 | /// Set the endpoints of a segment shape. 52 | void cpSegmentShapeSetEndpoints(cpShape *shape, cpVect a, cpVect b); 53 | /// Set the radius of a segment shape. 54 | void cpSegmentShapeSetRadius(cpShape *shape, cpFloat radius); 55 | 56 | /// Set the vertexes of a poly shape. 57 | void cpPolyShapeSetVerts(cpShape *shape, int numVerts, cpVect *verts, cpVect offset); 58 | 59 | #ifdef __cplusplus 60 | } 61 | #endif 62 | #endif 63 | /// @} 64 | -------------------------------------------------------------------------------- /td/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 | -------------------------------------------------------------------------------- /td/libs/Chipmunk/chipmunk/cpPolyShape.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2007 Scott Lembcke 2 | * 3 | * Permission is hereby granted, free of charge, to any person obtaining a copy 4 | * of this software and associated documentation files (the "Software"), to deal 5 | * in the Software without restriction, including without limitation the rights 6 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | * copies of the Software, and to permit persons to whom the Software is 8 | * furnished to do so, subject to the following conditions: 9 | * 10 | * The above copyright notice and this permission notice shall be included in 11 | * all copies or substantial portions of the Software. 12 | * 13 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 19 | * SOFTWARE. 20 | */ 21 | 22 | /// @defgroup cpPolyShape cpPolyShape 23 | /// @{ 24 | 25 | /// @private 26 | typedef struct cpPolyShapeAxis { 27 | cpVect n; 28 | cpFloat d; 29 | } cpPolyShapeAxis; 30 | 31 | /// @private 32 | typedef struct cpPolyShape { 33 | cpShape shape; 34 | 35 | int numVerts; 36 | cpVect *verts, *tVerts; 37 | cpPolyShapeAxis *axes, *tAxes; 38 | } cpPolyShape; 39 | 40 | /// Allocate a polygon shape. 41 | cpPolyShape* cpPolyShapeAlloc(void); 42 | /// Initialize a polygon shape. 43 | /// The vertexes must be convex and have a clockwise winding. 44 | cpPolyShape* cpPolyShapeInit(cpPolyShape *poly, cpBody *body, int numVerts, cpVect *verts, cpVect offset); 45 | /// Allocate and initialize a polygon shape. 46 | /// The vertexes must be convex and have a clockwise winding. 47 | cpShape* cpPolyShapeNew(cpBody *body, int numVerts, cpVect *verts, cpVect offset); 48 | 49 | /// Initialize a box shaped polygon shape. 50 | cpPolyShape* cpBoxShapeInit(cpPolyShape *poly, cpBody *body, cpFloat width, cpFloat height); 51 | /// Initialize an offset box shaped polygon shape. 52 | cpPolyShape* cpBoxShapeInit2(cpPolyShape *poly, cpBody *body, cpBB box); 53 | /// Allocate and initialize a box shaped polygon shape. 54 | cpShape* cpBoxShapeNew(cpBody *body, cpFloat width, cpFloat height); 55 | /// Allocate and initialize an offset box shaped polygon shape. 56 | cpShape* cpBoxShapeNew2(cpBody *body, cpBB box); 57 | 58 | /// Check that a set of vertexes is convex and has a clockwise winding. 59 | cpBool cpPolyValidate(const cpVect *verts, const int numVerts); 60 | 61 | /// Get the number of verts in a polygon shape. 62 | int cpPolyShapeGetNumVerts(cpShape *shape); 63 | /// Get the @c ith vertex of a polygon shape. 64 | cpVect cpPolyShapeGetVert(cpShape *shape, int idx); 65 | 66 | /// @} 67 | -------------------------------------------------------------------------------- /td/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 | -------------------------------------------------------------------------------- /td/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 | -------------------------------------------------------------------------------- /td/libs/cocos2d/CCAnimationCache.m: -------------------------------------------------------------------------------- 1 | /* 2 | * cocos2d for iPhone: http://www.cocos2d-iphone.org 3 | * 4 | * Copyright (c) 2010 Ricardo Quesada 5 | * Copyright (c) 2011 Zynga Inc. 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 | #import "ccMacros.h" 28 | #import "CCAnimationCache.h" 29 | #import "CCAnimation.h" 30 | #import "CCSprite.h" 31 | 32 | 33 | @implementation CCAnimationCache 34 | 35 | #pragma mark CCAnimationCache - Alloc, Init & Dealloc 36 | 37 | static CCAnimationCache *sharedAnimationCache_=nil; 38 | 39 | + (CCAnimationCache *)sharedAnimationCache 40 | { 41 | if (!sharedAnimationCache_) 42 | sharedAnimationCache_ = [[CCAnimationCache alloc] init]; 43 | 44 | return sharedAnimationCache_; 45 | } 46 | 47 | +(id)alloc 48 | { 49 | NSAssert(sharedAnimationCache_ == nil, @"Attempted to allocate a second instance of a singleton."); 50 | return [super alloc]; 51 | } 52 | 53 | +(void)purgeSharedAnimationCache 54 | { 55 | [sharedAnimationCache_ release]; 56 | sharedAnimationCache_ = nil; 57 | } 58 | 59 | -(id) init 60 | { 61 | if( (self=[super init]) ) { 62 | animations_ = [[NSMutableDictionary alloc] initWithCapacity: 20]; 63 | } 64 | 65 | return self; 66 | } 67 | 68 | - (NSString*) description 69 | { 70 | return [NSString stringWithFormat:@"<%@ = %08X | num of animations = %i>", [self class], self, [animations_ count]]; 71 | } 72 | 73 | -(void) dealloc 74 | { 75 | CCLOGINFO(@"cocos2d: deallocing %@", self); 76 | 77 | [animations_ release]; 78 | [super dealloc]; 79 | } 80 | 81 | #pragma mark CCAnimationCache - load/get/del 82 | 83 | -(void) addAnimation:(CCAnimation*)animation name:(NSString*)name 84 | { 85 | [animations_ setObject:animation forKey:name]; 86 | } 87 | 88 | -(void) removeAnimationByName:(NSString*)name 89 | { 90 | if( ! name ) 91 | return; 92 | 93 | [animations_ removeObjectForKey:name]; 94 | } 95 | 96 | -(CCAnimation*) animationByName:(NSString*)name 97 | { 98 | return [animations_ objectForKey:name]; 99 | } 100 | 101 | @end 102 | -------------------------------------------------------------------------------- /td/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 | -------------------------------------------------------------------------------- /td/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 | -------------------------------------------------------------------------------- /td/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 | -------------------------------------------------------------------------------- /td/libs/cocos2d/CCTileMapAtlas.h: -------------------------------------------------------------------------------- 1 | /* 2 | * cocos2d for iPhone: http://www.cocos2d-iphone.org 3 | * 4 | * Copyright (c) 2008-2010 Ricardo Quesada 5 | * Copyright (c) 2011 Zynga Inc. 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 | #import "CCTextureAtlas.h" 28 | #import "CCAtlasNode.h" 29 | #import "Support/TGAlib.h" 30 | 31 | /** CCTileMapAtlas is a subclass of CCAtlasNode. 32 | 33 | It knows how to render a map based of tiles. 34 | The tiles must be in a .PNG format while the map must be a .TGA file. 35 | 36 | For more information regarding the format, please see this post: 37 | http://www.cocos2d-iphone.org/archives/27 38 | 39 | All features from CCAtlasNode are valid in CCTileMapAtlas 40 | 41 | IMPORTANT: 42 | This class is deprecated. It is maintained for compatibility reasons only. 43 | You SHOULD not use this class. 44 | Instead, use the newer TMX file format: CCTMXTiledMap 45 | */ 46 | @interface CCTileMapAtlas : CCAtlasNode 47 | { 48 | 49 | /// info about the map file 50 | tImageTGA *tgaInfo; 51 | 52 | /// x,y to altas dicctionary 53 | NSMutableDictionary *posToAtlasIndex; 54 | 55 | /// numbers of tiles to render 56 | int itemsToRender; 57 | } 58 | 59 | /** TileMap info */ 60 | @property (nonatomic,readonly) tImageTGA *tgaInfo; 61 | 62 | /** creates a CCTileMap with a tile file (atlas) with a map file and the width and height of each tile in points. 63 | The tile file will be loaded using the TextureMgr. 64 | */ 65 | +(id) tileMapAtlasWithTileFile:(NSString*)tile mapFile:(NSString*)map tileWidth:(int)w tileHeight:(int)h; 66 | 67 | /** initializes a CCTileMap with a tile file (atlas) with a map file and the width and height of each tile in points. 68 | The file will be loaded using the TextureMgr. 69 | */ 70 | -(id) initWithTileFile:(NSString*)tile mapFile:(NSString*)map tileWidth:(int)w tileHeight:(int)h; 71 | 72 | /** returns a tile from position x,y. 73 | For the moment only channel R is used 74 | */ 75 | -(ccColor3B) tileAt: (ccGridSize) position; 76 | 77 | /** sets a tile at position x,y. 78 | For the moment only channel R is used 79 | */ 80 | -(void) setTile:(ccColor3B)tile at:(ccGridSize)position; 81 | /** dealloc the map from memory */ 82 | -(void) releaseMap; 83 | @end 84 | -------------------------------------------------------------------------------- /td/libs/cocos2d/Platforms/iOS/CCTouchDelegateProtocol.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 | // Only compile this code on iOS. These files should NOT be included on your Mac project. 27 | // But in case they are included, it won't be compiled. 28 | #import 29 | #ifdef __IPHONE_OS_VERSION_MAX_ALLOWED 30 | 31 | #import 32 | 33 | /** 34 | CCTargetedTouchDelegate. 35 | 36 | Using this type of delegate results in two benefits: 37 | 1. You don't need to deal with NSSets, the dispatcher does the job of splitting 38 | them. You get exactly one UITouch per call. 39 | 2. You can *claim* a UITouch by returning YES in ccTouchBegan. Updates of claimed 40 | touches are sent only to the delegate(s) that claimed them. So if you get a move/ 41 | ended/cancelled update you're sure it's your touch. This frees you from doing a 42 | lot of checks when doing multi-touch. 43 | 44 | (The name TargetedTouchDelegate relates to updates "targeting" their specific 45 | handler, without bothering the other handlers.) 46 | @since v0.8 47 | */ 48 | @protocol CCTargetedTouchDelegate 49 | 50 | /** Return YES to claim the touch. 51 | @since v0.8 52 | */ 53 | - (BOOL)ccTouchBegan:(UITouch *)touch withEvent:(UIEvent *)event; 54 | @optional 55 | // touch updates: 56 | - (void)ccTouchMoved:(UITouch *)touch withEvent:(UIEvent *)event; 57 | - (void)ccTouchEnded:(UITouch *)touch withEvent:(UIEvent *)event; 58 | - (void)ccTouchCancelled:(UITouch *)touch withEvent:(UIEvent *)event; 59 | @end 60 | 61 | /** 62 | CCStandardTouchDelegate. 63 | 64 | This type of delegate is the same one used by CocoaTouch. You will receive all the events (Began,Moved,Ended,Cancelled). 65 | @since v0.8 66 | */ 67 | @protocol CCStandardTouchDelegate 68 | @optional 69 | - (void)ccTouchesBegan:(NSSet *)touches withEvent:(UIEvent *)event; 70 | - (void)ccTouchesMoved:(NSSet *)touches withEvent:(UIEvent *)event; 71 | - (void)ccTouchesEnded:(NSSet *)touches withEvent:(UIEvent *)event; 72 | - (void)ccTouchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event; 73 | @end 74 | 75 | #endif // __IPHONE_OS_VERSION_MAX_ALLOWED 76 | -------------------------------------------------------------------------------- /td/libs/cocos2d/CCMenu.h: -------------------------------------------------------------------------------- 1 | /* 2 | * cocos2d for iPhone: http://www.cocos2d-iphone.org 3 | * 4 | * Copyright (c) 2008-2010 Ricardo Quesada 5 | * Copyright (c) 2011 Zynga Inc. 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 "CCMenuItem.h" 29 | #import "CCLayer.h" 30 | 31 | typedef enum { 32 | kCCMenuStateWaiting, 33 | kCCMenuStateTrackingTouch 34 | } tCCMenuState; 35 | 36 | enum { 37 | //* priority used by the menu for the touches 38 | kCCMenuTouchPriority = -128, 39 | 40 | //* priority used by the menu for the mouse 41 | kCCMenuMousePriority = -128, 42 | }; 43 | 44 | /** A CCMenu 45 | * 46 | * Features and Limitation: 47 | * - You can add MenuItem objects in runtime using addChild: 48 | * - But the only accecpted children are MenuItem objects 49 | */ 50 | @interface CCMenu : CCLayer 51 | { 52 | tCCMenuState state_; 53 | CCMenuItem *selectedItem_; 54 | GLubyte opacity_; 55 | ccColor3B color_; 56 | } 57 | 58 | /** creates a CCMenu with it's items */ 59 | + (id) menuWithItems: (CCMenuItem*) item, ... NS_REQUIRES_NIL_TERMINATION; 60 | 61 | /** initializes a CCMenu with it's items */ 62 | - (id) initWithItems: (CCMenuItem*) item vaList: (va_list) args; 63 | 64 | /** align items vertically */ 65 | -(void) alignItemsVertically; 66 | /** align items vertically with padding 67 | @since v0.7.2 68 | */ 69 | -(void) alignItemsVerticallyWithPadding:(float) padding; 70 | 71 | /** align items horizontally */ 72 | -(void) alignItemsHorizontally; 73 | /** align items horizontally with padding 74 | @since v0.7.2 75 | */ 76 | -(void) alignItemsHorizontallyWithPadding: (float) padding; 77 | 78 | 79 | /** align items in rows of columns */ 80 | -(void) alignItemsInColumns: (NSNumber *) columns, ... NS_REQUIRES_NIL_TERMINATION; 81 | -(void) alignItemsInColumns: (NSNumber *) columns vaList: (va_list) args; 82 | 83 | /** align items in columns of rows */ 84 | -(void) alignItemsInRows: (NSNumber *) rows, ... NS_REQUIRES_NIL_TERMINATION; 85 | -(void) alignItemsInRows: (NSNumber *) rows vaList: (va_list) args; 86 | 87 | 88 | /** conforms to CCRGBAProtocol protocol */ 89 | @property (nonatomic,readonly) GLubyte opacity; 90 | /** conforms to CCRGBAProtocol protocol */ 91 | @property (nonatomic,readonly) ccColor3B color; 92 | 93 | @end 94 | -------------------------------------------------------------------------------- /td/libs/cocos2d/Platforms/Mac/MacGLView.h: -------------------------------------------------------------------------------- 1 | /* 2 | * cocos2d for iPhone: http://www.cocos2d-iphone.org 3 | * 4 | * Copyright (c) 2010 Ricardo Quesada 5 | * Copyright (c) 2011 Zynga Inc. 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 | // Only compile this code on Mac. These files should not be included on your iOS project. 27 | // But in case they are included, it won't be compiled. 28 | #import 29 | #ifdef __IPHONE_OS_VERSION_MAX_ALLOWED 30 | #elif defined(__MAC_OS_X_VERSION_MAX_ALLOWED) 31 | 32 | #import 33 | 34 | #import "../../ccConfig.h" 35 | 36 | //PROTOCOLS: 37 | 38 | @protocol MacEventDelegate 39 | // Mouse 40 | - (void)mouseDown:(NSEvent *)theEvent; 41 | - (void)mouseUp:(NSEvent *)theEvent; 42 | - (void)mouseMoved:(NSEvent *)theEvent; 43 | - (void)mouseDragged:(NSEvent *)theEvent; 44 | - (void)rightMouseDown:(NSEvent*)event; 45 | - (void)rightMouseDragged:(NSEvent*)event; 46 | - (void)rightMouseUp:(NSEvent*)event; 47 | - (void)otherMouseDown:(NSEvent*)event; 48 | - (void)otherMouseDragged:(NSEvent*)event; 49 | - (void)otherMouseUp:(NSEvent*)event; 50 | - (void)scrollWheel:(NSEvent *)theEvent; 51 | - (void)mouseEntered:(NSEvent *)theEvent; 52 | - (void)mouseExited:(NSEvent *)theEvent; 53 | 54 | 55 | // Keyboard 56 | - (void)keyDown:(NSEvent *)theEvent; 57 | - (void)keyUp:(NSEvent *)theEvent; 58 | - (void)flagsChanged:(NSEvent *)theEvent; 59 | 60 | // Touches 61 | - (void)touchesBeganWithEvent:(NSEvent *)event; 62 | - (void)touchesMovedWithEvent:(NSEvent *)event; 63 | - (void)touchesEndedWithEvent:(NSEvent *)event; 64 | - (void)touchesCancelledWithEvent:(NSEvent *)event; 65 | 66 | #if CC_DIRECTOR_MAC_USE_DISPLAY_LINK_THREAD 67 | - (void)queueEvent:(NSEvent*)event selector:(SEL)selector; 68 | #endif 69 | 70 | @end 71 | 72 | /** MacGLView 73 | 74 | Only available for Mac OS X 75 | */ 76 | @interface MacGLView : NSOpenGLView { 77 | id eventDelegate_; 78 | } 79 | 80 | @property (nonatomic, readwrite, assign) id eventDelegate; 81 | 82 | // initializes the MacGLView with a frame rect and an OpenGL context 83 | - (id) initWithFrame:(NSRect)frameRect shareContext:(NSOpenGLContext*)context; 84 | 85 | // private 86 | +(void) load_; 87 | @end 88 | 89 | #endif // __MAC_OS_X_VERSION_MAX_ALLOWED -------------------------------------------------------------------------------- /td.xcodeproj/xcuserdata/Lars.xcuserdatad/xcschemes/td.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 4 | 7 | 8 | 14 | 20 | 21 | 22 | 23 | 24 | 29 | 30 | 31 | 32 | 38 | 39 | 40 | 41 | 49 | 50 | 56 | 57 | 58 | 59 | 60 | 61 | 67 | 68 | 74 | 75 | 76 | 77 | 79 | 80 | 83 | 84 | 85 | -------------------------------------------------------------------------------- /td/libs/cocos2d/CCParticleExamples.h: -------------------------------------------------------------------------------- 1 | /* 2 | * cocos2d for iPhone: http://www.cocos2d-iphone.org 3 | * 4 | * Copyright (c) 2008-2010 Ricardo Quesada 5 | * Copyright (c) 2011 Zynga Inc. 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 29 | 30 | #import "CCParticleSystemPoint.h" 31 | #import "CCParticleSystemQuad.h" 32 | 33 | // build each architecture with the optimal particle system 34 | 35 | // ARMv7, Mac or Simulator use "Quad" particle 36 | #if defined(__ARM_NEON__) || defined(__MAC_OS_X_VERSION_MAX_ALLOWED) || TARGET_IPHONE_SIMULATOR 37 | #define ARCH_OPTIMAL_PARTICLE_SYSTEM CCParticleSystemQuad 38 | 39 | // ARMv6 use "Point" particle 40 | #elif __arm__ 41 | #define ARCH_OPTIMAL_PARTICLE_SYSTEM CCParticleSystemPoint 42 | #else 43 | #error(unknown architecture) 44 | #endif 45 | 46 | 47 | //! A fire particle system 48 | @interface CCParticleFire: ARCH_OPTIMAL_PARTICLE_SYSTEM 49 | { 50 | } 51 | @end 52 | 53 | //! A fireworks particle system 54 | @interface CCParticleFireworks : ARCH_OPTIMAL_PARTICLE_SYSTEM 55 | { 56 | } 57 | @end 58 | 59 | //! A sun particle system 60 | @interface CCParticleSun : ARCH_OPTIMAL_PARTICLE_SYSTEM 61 | { 62 | } 63 | @end 64 | 65 | //! A galaxy particle system 66 | @interface CCParticleGalaxy : ARCH_OPTIMAL_PARTICLE_SYSTEM 67 | { 68 | } 69 | @end 70 | 71 | //! A flower particle system 72 | @interface CCParticleFlower : ARCH_OPTIMAL_PARTICLE_SYSTEM 73 | { 74 | } 75 | @end 76 | 77 | //! A meteor particle system 78 | @interface CCParticleMeteor : ARCH_OPTIMAL_PARTICLE_SYSTEM 79 | { 80 | } 81 | @end 82 | 83 | //! An spiral particle system 84 | @interface CCParticleSpiral : ARCH_OPTIMAL_PARTICLE_SYSTEM 85 | { 86 | } 87 | @end 88 | 89 | //! An explosion particle system 90 | @interface CCParticleExplosion : ARCH_OPTIMAL_PARTICLE_SYSTEM 91 | { 92 | } 93 | @end 94 | 95 | //! An smoke particle system 96 | @interface CCParticleSmoke : ARCH_OPTIMAL_PARTICLE_SYSTEM 97 | { 98 | } 99 | @end 100 | 101 | //! An snow particle system 102 | @interface CCParticleSnow : ARCH_OPTIMAL_PARTICLE_SYSTEM 103 | { 104 | } 105 | @end 106 | 107 | //! A rain particle system 108 | @interface CCParticleRain : ARCH_OPTIMAL_PARTICLE_SYSTEM 109 | { 110 | } 111 | @end 112 | -------------------------------------------------------------------------------- /td/libs/FontLabel/ZAttributedString.h: -------------------------------------------------------------------------------- 1 | // 2 | // ZAttributedString.h 3 | // FontLabel 4 | // 5 | // Created by Kevin Ballard on 9/22/09. 6 | // Copyright 2009 Zynga Game Networks. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | #if NS_BLOCKS_AVAILABLE 12 | #define Z_BLOCKS 1 13 | #else 14 | // set this to 1 if you are using PLBlocks 15 | #define Z_BLOCKS 0 16 | #endif 17 | 18 | #if Z_BLOCKS 19 | enum { 20 | ZAttributedStringEnumerationReverse = (1UL << 1), 21 | ZAttributedStringEnumerationLongestEffectiveRangeNotRequired = (1UL << 20) 22 | }; 23 | typedef NSUInteger ZAttributedStringEnumerationOptions; 24 | #endif 25 | 26 | @interface ZAttributedString : NSObject { 27 | NSMutableString *_buffer; 28 | NSMutableArray *_attributes; 29 | } 30 | @property (nonatomic, readonly) NSUInteger length; 31 | @property (nonatomic, readonly) NSString *string; 32 | - (id)initWithAttributedString:(ZAttributedString *)attr; 33 | - (id)initWithString:(NSString *)str; 34 | - (id)initWithString:(NSString *)str attributes:(NSDictionary *)attributes; 35 | - (id)attribute:(NSString *)attributeName atIndex:(NSUInteger)index effectiveRange:(NSRangePointer)aRange; 36 | - (id)attribute:(NSString *)attributeName atIndex:(NSUInteger)index longestEffectiveRange:(NSRangePointer)aRange inRange:(NSRange)rangeLimit; 37 | - (ZAttributedString *)attributedSubstringFromRange:(NSRange)aRange; 38 | - (NSDictionary *)attributesAtIndex:(NSUInteger)index effectiveRange:(NSRangePointer)aRange; 39 | - (NSDictionary *)attributesAtIndex:(NSUInteger)index longestEffectiveRange:(NSRangePointer)aRange inRange:(NSRange)rangeLimit; 40 | #if Z_BLOCKS 41 | - (void)enumerateAttribute:(NSString *)attrName inRange:(NSRange)enumerationRange options:(ZAttributedStringEnumerationOptions)opts 42 | usingBlock:(void (^)(id value, NSRange range, BOOL *stop))block; 43 | - (void)enumerateAttributesInRange:(NSRange)enumerationRange options:(ZAttributedStringEnumerationOptions)opts 44 | usingBlock:(void (^)(NSDictionary *attrs, NSRange range, BOOL *stop))block; 45 | #endif 46 | - (BOOL)isEqualToAttributedString:(ZAttributedString *)otherString; 47 | @end 48 | 49 | @interface ZMutableAttributedString : ZAttributedString { 50 | } 51 | - (void)addAttribute:(NSString *)name value:(id)value range:(NSRange)range; 52 | - (void)addAttributes:(NSDictionary *)attributes range:(NSRange)range; 53 | - (void)appendAttributedString:(ZAttributedString *)str; 54 | - (void)deleteCharactersInRange:(NSRange)range; 55 | - (void)insertAttributedString:(ZAttributedString *)str atIndex:(NSUInteger)idx; 56 | - (void)removeAttribute:(NSString *)name range:(NSRange)range; 57 | - (void)replaceCharactersInRange:(NSRange)range withAttributedString:(ZAttributedString *)str; 58 | - (void)replaceCharactersInRange:(NSRange)range withString:(NSString *)str; 59 | - (void)setAttributedString:(ZAttributedString *)str; 60 | - (void)setAttributes:(NSDictionary *)attributes range:(NSRange)range; 61 | @end 62 | 63 | extern NSString * const ZFontAttributeName; 64 | extern NSString * const ZForegroundColorAttributeName; 65 | extern NSString * const ZBackgroundColorAttributeName; 66 | extern NSString * const ZUnderlineStyleAttributeName; 67 | 68 | enum { 69 | ZUnderlineStyleNone = 0x00, 70 | ZUnderlineStyleSingle = 0x01 71 | }; 72 | #define ZUnderlineStyleMask 0x00FF 73 | 74 | enum { 75 | ZUnderlinePatternSolid = 0x0000 76 | }; 77 | #define ZUnderlinePatternMask 0xFF00 78 | -------------------------------------------------------------------------------- /td/libs/cocos2d/Platforms/CCGL.h: -------------------------------------------------------------------------------- 1 | /* 2 | * cocos2d for iPhone: http://www.cocos2d-iphone.org 3 | * 4 | * Copyright (c) 2010 Ricardo Quesada 5 | * Copyright (c) 2011 Zynga Inc. 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 | // Common layer for OpenGL stuff 28 | // 29 | 30 | #import 31 | 32 | #ifdef __IPHONE_OS_VERSION_MAX_ALLOWED 33 | #import 34 | #import 35 | #import 36 | #import "iOS/glu.h" 37 | #import "iOS/EAGLView.h" 38 | 39 | #elif defined(__MAC_OS_X_VERSION_MAX_ALLOWED) 40 | #import 41 | #import 42 | #import // needed for NSOpenGLView 43 | #import "Mac/MacGLView.h" 44 | #endif 45 | 46 | 47 | // iOS 48 | #ifdef __IPHONE_OS_VERSION_MAX_ALLOWED 49 | #define CC_GLVIEW EAGLView 50 | #define ccglOrtho glOrthof 51 | #define ccglClearDepth glClearDepthf 52 | #define ccglGenerateMipmap glGenerateMipmapOES 53 | #define ccglGenFramebuffers glGenFramebuffersOES 54 | #define ccglBindFramebuffer glBindFramebufferOES 55 | #define ccglFramebufferTexture2D glFramebufferTexture2DOES 56 | #define ccglDeleteFramebuffers glDeleteFramebuffersOES 57 | #define ccglCheckFramebufferStatus glCheckFramebufferStatusOES 58 | #define ccglTranslate glTranslatef 59 | 60 | #define CC_GL_FRAMEBUFFER GL_FRAMEBUFFER_OES 61 | #define CC_GL_FRAMEBUFFER_BINDING GL_FRAMEBUFFER_BINDING_OES 62 | #define CC_GL_COLOR_ATTACHMENT0 GL_COLOR_ATTACHMENT0_OES 63 | #define CC_GL_FRAMEBUFFER_COMPLETE GL_FRAMEBUFFER_COMPLETE_OES 64 | 65 | // Mac 66 | #elif defined(__MAC_OS_X_VERSION_MAX_ALLOWED) 67 | #define CC_GLVIEW MacGLView 68 | #define ccglOrtho glOrtho 69 | #define ccglClearDepth glClearDepth 70 | #define ccglGenerateMipmap glGenerateMipmap 71 | #define ccglGenFramebuffers glGenFramebuffers 72 | #define ccglBindFramebuffer glBindFramebuffer 73 | #define ccglFramebufferTexture2D glFramebufferTexture2D 74 | #define ccglDeleteFramebuffers glDeleteFramebuffers 75 | #define ccglCheckFramebufferStatus glCheckFramebufferStatus 76 | #define ccglTranslate glTranslated 77 | 78 | #define CC_GL_FRAMEBUFFER GL_FRAMEBUFFER 79 | #define CC_GL_FRAMEBUFFER_BINDING GL_FRAMEBUFFER_BINDING 80 | #define CC_GL_COLOR_ATTACHMENT0 GL_COLOR_ATTACHMENT0 81 | #define CC_GL_FRAMEBUFFER_COMPLETE GL_FRAMEBUFFER_COMPLETE 82 | 83 | #endif 84 | -------------------------------------------------------------------------------- /td/libs/cocos2d/Platforms/CCNS.h: -------------------------------------------------------------------------------- 1 | /* 2 | * cocos2d for iPhone: http://www.cocos2d-iphone.org 3 | * 4 | * Copyright (c) 2010 Ricardo Quesada 5 | * Copyright (c) 2011 Zynga Inc. 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 | // Common layer for NS (Next-Step) stuff 28 | // 29 | 30 | #import 31 | 32 | #import // for NSObject 33 | 34 | #ifdef __IPHONE_OS_VERSION_MAX_ALLOWED 35 | 36 | #define CCRectFromString(__r__) CGRectFromString(__r__) 37 | #define CCPointFromString(__p__) CGPointFromString(__p__) 38 | #define CCSizeFromString(__s__) CGSizeFromString(__s__) 39 | #define CCNSSizeToCGSize 40 | #define CCNSRectToCGRect 41 | #define CCNSPointToCGPoint 42 | #define CCTextAlignment UITextAlignment 43 | #define CCTextAlignmentCenter UITextAlignmentCenter 44 | #define CCTextAlignmentLeft UITextAlignmentLeft 45 | #define CCTextAlignmentRight UITextAlignmentRight 46 | #define CCLineBreakMode UILineBreakMode 47 | #define CCLineBreakModeWordWrap UILineBreakModeWordWrap 48 | #define CCLineBreakModeCharacterWrap UILineBreakModeCharacterWrap 49 | #define CCLineBreakModeClip UILineBreakModeClip 50 | #define CCLineBreakModeHeadTruncation UILineBreakModeHeadTruncation 51 | #define CCLineBreakModeTailTruncation UILineBreakModeTailTruncation 52 | #define CCLineBreakModeMiddleTruncation UILineBreakModeMiddleTruncation 53 | 54 | 55 | 56 | #elif defined(__MAC_OS_X_VERSION_MAX_ALLOWED) 57 | 58 | #define CCRectFromString(__r__) NSRectToCGRect( NSRectFromString(__r__) ) 59 | #define CCPointFromString(__p__) NSPointToCGPoint( NSPointFromString(__p__) ) 60 | #define CCSizeFromString(__s__) NSSizeToCGSize( NSSizeFromString(__s__) ) 61 | #define CCNSSizeToCGSize NSSizeToCGSize 62 | #define CCNSRectToCGRect NSRectToCGRect 63 | #define CCNSPointToCGPoint NSPointToCGPoint 64 | #define CCTextAlignment NSTextAlignment 65 | #define CCTextAlignmentCenter NSCenterTextAlignment 66 | #define CCTextAlignmentLeft NSLeftTextAlignment 67 | #define CCTextAlignmentRight NSRightTextAlignment 68 | #define CCLineBreakMode NSLineBreakMode 69 | #define CCLineBreakModeWordWrap NSLineBreakByWordWrapping 70 | #define CCLineBreakModeClip -1 71 | #define CCLineBreakModeHeadTruncation -1 72 | #define CCLineBreakModeTailTruncation -1 73 | #define CCLineBreakModeMiddleTruncation -1 74 | 75 | 76 | #endif 77 | 78 | 79 | -------------------------------------------------------------------------------- /td/libs/cocos2d/CCActionProgressTimer.m: -------------------------------------------------------------------------------- 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 "CCActionProgressTimer.h" 28 | 29 | #define kProgressTimerCast CCProgressTimer* 30 | 31 | @implementation CCProgressTo 32 | +(id) actionWithDuration: (ccTime) t percent: (float) v 33 | { 34 | return [[[ self alloc] initWithDuration: t percent: v] autorelease]; 35 | } 36 | 37 | -(id) initWithDuration: (ccTime) t percent: (float) v 38 | { 39 | if( (self=[super initWithDuration: t] ) ) 40 | to_ = v; 41 | 42 | return self; 43 | } 44 | 45 | -(id) copyWithZone: (NSZone*) zone 46 | { 47 | CCAction *copy = [[[self class] allocWithZone: zone] initWithDuration:duration_ percent:to_]; 48 | return copy; 49 | } 50 | 51 | -(void) startWithTarget:(id) aTarget; 52 | { 53 | [super startWithTarget:aTarget]; 54 | from_ = [(kProgressTimerCast)target_ percentage]; 55 | 56 | // XXX: Is this correct ? 57 | // Adding it to support CCRepeat 58 | if( from_ == 100) 59 | from_ = 0; 60 | } 61 | 62 | -(void) update: (ccTime) t 63 | { 64 | [(kProgressTimerCast)target_ setPercentage: from_ + ( to_ - from_ ) * t]; 65 | } 66 | @end 67 | 68 | @implementation CCProgressFromTo 69 | +(id) actionWithDuration: (ccTime) t from:(float)fromPercentage to:(float) toPercentage 70 | { 71 | return [[[self alloc] initWithDuration: t from: fromPercentage to: toPercentage] autorelease]; 72 | } 73 | 74 | -(id) initWithDuration: (ccTime) t from:(float)fromPercentage to:(float) toPercentage 75 | { 76 | if( (self=[super initWithDuration: t] ) ){ 77 | to_ = toPercentage; 78 | from_ = fromPercentage; 79 | } 80 | return self; 81 | } 82 | 83 | -(id) copyWithZone: (NSZone*) zone 84 | { 85 | CCAction *copy = [[[self class] allocWithZone: zone] initWithDuration:duration_ from:from_ to:to_]; 86 | return copy; 87 | } 88 | 89 | - (CCActionInterval *) reverse 90 | { 91 | return [[self class] actionWithDuration:duration_ from:to_ to:from_]; 92 | } 93 | 94 | -(void) startWithTarget:(id) aTarget; 95 | { 96 | [super startWithTarget:aTarget]; 97 | } 98 | 99 | -(void) update: (ccTime) t 100 | { 101 | [(kProgressTimerCast)target_ setPercentage: from_ + ( to_ - from_ ) * t]; 102 | } 103 | @end 104 | -------------------------------------------------------------------------------- /td/libs/cocos2d/CCAnimation.m: -------------------------------------------------------------------------------- 1 | /* 2 | * cocos2d for iPhone: http://www.cocos2d-iphone.org 3 | * 4 | * Copyright (c) 2008-2010 Ricardo Quesada 5 | * Copyright (c) 2011 Zynga Inc. 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 | #import "ccMacros.h" 28 | #import "CCAnimation.h" 29 | #import "CCSpriteFrame.h" 30 | #import "CCTexture2D.h" 31 | #import "CCTextureCache.h" 32 | 33 | @implementation CCAnimation 34 | @synthesize name = name_, delay = delay_, frames = frames_; 35 | 36 | +(id) animation 37 | { 38 | return [[[self alloc] init] autorelease]; 39 | } 40 | 41 | +(id) animationWithFrames:(NSArray*)frames 42 | { 43 | return [[[self alloc] initWithFrames:frames] autorelease]; 44 | } 45 | 46 | +(id) animationWithFrames:(NSArray*)frames delay:(float)delay 47 | { 48 | return [[[self alloc] initWithFrames:frames delay:delay] autorelease]; 49 | } 50 | 51 | -(id) init 52 | { 53 | return [self initWithFrames:nil delay:0]; 54 | } 55 | 56 | -(id) initWithFrames:(NSArray*)frames 57 | { 58 | return [self initWithFrames:frames delay:0]; 59 | } 60 | 61 | -(id) initWithFrames:(NSArray*)array delay:(float)delay 62 | { 63 | if( (self=[super init]) ) { 64 | 65 | delay_ = delay; 66 | self.frames = [NSMutableArray arrayWithArray:array]; 67 | } 68 | return self; 69 | } 70 | 71 | - (NSString*) description 72 | { 73 | return [NSString stringWithFormat:@"<%@ = %08X | frames=%d, delay:%f>", [self class], self, 74 | [frames_ count], 75 | delay_ 76 | ]; 77 | } 78 | 79 | -(void) dealloc 80 | { 81 | CCLOGINFO( @"cocos2d: deallocing %@",self); 82 | [name_ release]; 83 | [frames_ release]; 84 | [super dealloc]; 85 | } 86 | 87 | -(void) addFrame:(CCSpriteFrame*)frame 88 | { 89 | [frames_ addObject:frame]; 90 | } 91 | 92 | -(void) addFrameWithFilename:(NSString*)filename 93 | { 94 | CCTexture2D *texture = [[CCTextureCache sharedTextureCache] addImage:filename]; 95 | CGRect rect = CGRectZero; 96 | rect.size = texture.contentSize; 97 | CCSpriteFrame *frame = [CCSpriteFrame frameWithTexture:texture rect:rect]; 98 | [frames_ addObject:frame]; 99 | } 100 | 101 | -(void) addFrameWithTexture:(CCTexture2D*)texture rect:(CGRect)rect 102 | { 103 | CCSpriteFrame *frame = [CCSpriteFrame frameWithTexture:texture rect:rect]; 104 | [frames_ addObject:frame]; 105 | } 106 | 107 | @end 108 | -------------------------------------------------------------------------------- /td/libs/cocos2d/CCDrawingPrimitives.h: -------------------------------------------------------------------------------- 1 | /* 2 | * cocos2d for iPhone: http://www.cocos2d-iphone.org 3 | * 4 | * Copyright (c) 2008-2010 Ricardo Quesada 5 | * Copyright (c) 2011 Zynga Inc. 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 | #ifndef __CC_DRAWING_PRIMITIVES_H 28 | #define __CC_DRAWING_PRIMITIVES_H 29 | 30 | #import 31 | #import 32 | 33 | #ifdef __IPHONE_OS_VERSION_MAX_ALLOWED 34 | #import // for CGPoint 35 | #endif 36 | 37 | 38 | #ifdef __cplusplus 39 | extern "C" { 40 | #endif 41 | 42 | /** 43 | @file 44 | Drawing OpenGL ES primitives. 45 | - ccDrawPoint 46 | - ccDrawLine 47 | - ccDrawPoly 48 | - ccDrawCircle 49 | - ccDrawQuadBezier 50 | - ccDrawCubicBezier 51 | 52 | You can change the color, width and other property by calling the 53 | glColor4ub(), glLineWidth(), glPointSize(). 54 | 55 | @warning These functions draws the Line, Point, Polygon, immediately. They aren't batched. If you are going to make a game that depends on these primitives, I suggest creating a batch. 56 | */ 57 | 58 | 59 | /** draws a point given x and y coordinate measured in points. */ 60 | void ccDrawPoint( CGPoint point ); 61 | 62 | /** draws an array of points. 63 | @since v0.7.2 64 | */ 65 | void ccDrawPoints( const CGPoint *points, NSUInteger numberOfPoints ); 66 | 67 | /** draws a line given the origin and destination point measured in points. */ 68 | void ccDrawLine( CGPoint origin, CGPoint destination ); 69 | 70 | /** draws a poligon given a pointer to CGPoint coordiantes and the number of vertices measured in points. 71 | The polygon can be closed or open 72 | */ 73 | void ccDrawPoly( const CGPoint *vertices, NSUInteger numOfVertices, BOOL closePolygon ); 74 | 75 | /** draws a circle given the center, radius and number of segments measured in points */ 76 | void ccDrawCircle( CGPoint center, float radius, float angle, NSUInteger segments, BOOL drawLineToCenter); 77 | 78 | /** draws a quad bezier path measured in points. 79 | @since v0.8 80 | */ 81 | void ccDrawQuadBezier(CGPoint origin, CGPoint control, CGPoint destination, NSUInteger segments); 82 | 83 | /** draws a cubic bezier path measured in points. 84 | @since v0.8 85 | */ 86 | void ccDrawCubicBezier(CGPoint origin, CGPoint control1, CGPoint control2, CGPoint destination, NSUInteger segments); 87 | 88 | #ifdef __cplusplus 89 | } 90 | #endif 91 | 92 | #endif // __CC_DRAWING_PRIMITIVES_H 93 | -------------------------------------------------------------------------------- /td/libs/cocos2d/CCAnimation.h: -------------------------------------------------------------------------------- 1 | /* 2 | * cocos2d for iPhone: http://www.cocos2d-iphone.org 3 | * 4 | * Copyright (c) 2008-2010 Ricardo Quesada 5 | * Copyright (c) 2011 Zynga Inc. 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 | #import 28 | #ifdef __IPHONE_OS_VERSION_MAX_ALLOWED 29 | #import 30 | #endif // IPHONE 31 | 32 | @class CCSpriteFrame; 33 | @class CCTexture2D; 34 | 35 | /** A CCAnimation object is used to perform animations on the CCSprite objects. 36 | 37 | The CCAnimation object contains CCSpriteFrame objects, and a possible delay between the frames. 38 | You can animate a CCAnimation object by using the CCAnimate action. Example: 39 | 40 | [sprite runAction:[CCAnimate actionWithAnimation:animation]]; 41 | 42 | */ 43 | @interface CCAnimation : NSObject 44 | { 45 | NSString *name_; 46 | float delay_; 47 | NSMutableArray *frames_; 48 | } 49 | 50 | /** name of the animation */ 51 | @property (nonatomic,readwrite,retain) NSString *name; 52 | /** delay between frames in seconds. */ 53 | @property (nonatomic,readwrite,assign) float delay; 54 | /** array of frames */ 55 | @property (nonatomic,readwrite,retain) NSMutableArray *frames; 56 | 57 | /** Creates an animation 58 | @since v0.99.5 59 | */ 60 | +(id) animation; 61 | 62 | /** Creates an animation with frames. 63 | @since v0.99.5 64 | */ 65 | +(id) animationWithFrames:(NSArray*)frames; 66 | 67 | /* Creates an animation with frames and a delay between frames. 68 | @since v0.99.5 69 | */ 70 | +(id) animationWithFrames:(NSArray*)frames delay:(float)delay; 71 | 72 | /** Initializes a CCAnimation with frames. 73 | @since v0.99.5 74 | */ 75 | -(id) initWithFrames:(NSArray*)frames; 76 | 77 | /** Initializes a CCAnimation with frames and a delay between frames 78 | @since v0.99.5 79 | */ 80 | -(id) initWithFrames:(NSArray *)frames delay:(float)delay; 81 | 82 | /** Adds a frame to a CCAnimation. */ 83 | -(void) addFrame:(CCSpriteFrame*)frame; 84 | 85 | /** Adds a frame with an image filename. Internally it will create a CCSpriteFrame and it will add it. 86 | Added to facilitate the migration from v0.8 to v0.9. 87 | */ 88 | -(void) addFrameWithFilename:(NSString*)filename; 89 | 90 | /** Adds a frame with a texture and a rect. Internally it will create a CCSpriteFrame and it will add it. 91 | Added to facilitate the migration from v0.8 to v0.9. 92 | */ 93 | -(void) addFrameWithTexture:(CCTexture2D*)texture rect:(CGRect)rect; 94 | 95 | @end 96 | --------------------------------------------------------------------------------