├── cocos2d-extensions
├── Resources
│ ├── Icon.png
│ ├── Default.png
│ ├── Icon-72.png
│ ├── Icon@2x.png
│ ├── iTunesArtwork
│ ├── Icon-Small.png
│ ├── fps_images.png
│ ├── Icon-Small-50.png
│ ├── Icon-Small@2x.png
│ └── Info.plist
├── test
│ ├── CCBumperTest
│ │ ├── Resources
│ │ │ └── Bumper.png
│ │ ├── CCBumperTest.h
│ │ └── CCBumperTest.m
│ └── CCResourceAsyncLoaderTest
│ │ ├── Resources
│ │ ├── .jpg
│ │ ├── 1.png
│ │ ├── 2.png
│ │ ├── 3.png
│ │ └── 4.png
│ │ ├── CCResourceAsyncLoaderTest.h
│ │ └── CCResourceAsyncLoaderTest.m
├── RootViewController.h
├── Prefix.pch
├── AppDelegate.h
├── libs
│ ├── 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
│ │ │ ├── base64.c
│ │ │ ├── ZipUtils.h
│ │ │ ├── CCProfiling.m
│ │ │ └── CCArray.h
│ │ ├── Platforms
│ │ │ ├── iOS
│ │ │ │ ├── glu.h
│ │ │ │ ├── ESRenderer.h
│ │ │ │ ├── ES1Renderer.h
│ │ │ │ ├── glu.c
│ │ │ │ ├── CCTouchDelegateProtocol.h
│ │ │ │ └── CCTouchHandler.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
│ │ ├── CCActionCamera.h
│ │ ├── CCParticleSystemQuad.h
│ │ ├── CCActionPageTurn3D.m
│ │ ├── CCLabelAtlas.h
│ │ ├── CCMotionStreak.h
│ │ ├── CCAnimationCache.m
│ │ ├── CCGrabber.m
│ │ ├── CCProgressTimer.h
│ │ ├── CCTileMapAtlas.h
│ │ ├── CCMenu.h
│ │ ├── CCParticleExamples.h
│ │ ├── CCActionProgressTimer.m
│ │ ├── CCAtlasNode.h
│ │ ├── CCDrawingPrimitives.h
│ │ ├── CCTransitionPageTurn.m
│ │ ├── CCCamera.h
│ │ ├── CCCamera.m
│ │ └── CCMotionStreak.m
│ ├── FontLabel
│ │ ├── ZAttributedStringPrivate.h
│ │ ├── ZFont.h
│ │ ├── FontLabel.h
│ │ ├── ZAttributedString.h
│ │ └── FontManager.h
│ ├── LICENSE_TouchJSON.txt
│ ├── LICENSE_CocosDenshion.txt
│ ├── LICENSE_cocos2d.txt
│ ├── cocoslive
│ │ ├── cocoslive.m
│ │ └── cocoslive.h
│ └── CocosDenshion
│ │ ├── CDConfig.h
│ │ └── CDOpenALSupport.h
├── main.m
├── GameConfig.h
├── extensions
│ ├── CCBumper.h
│ ├── CCResourceAsyncLoader.h
│ ├── CCBumper.m
│ ├── CCResourceAsyncLoader.m
│ └── CCSendMessages.h
└── ExtensionTest.h
├── cocos2d-extensions.xcodeproj
└── project.xcworkspace
│ └── contents.xcworkspacedata
└── README
/cocos2d-extensions/Resources/Icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Seasons7/cocos2d-extensions/HEAD/cocos2d-extensions/Resources/Icon.png
--------------------------------------------------------------------------------
/cocos2d-extensions/Resources/Default.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Seasons7/cocos2d-extensions/HEAD/cocos2d-extensions/Resources/Default.png
--------------------------------------------------------------------------------
/cocos2d-extensions/Resources/Icon-72.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Seasons7/cocos2d-extensions/HEAD/cocos2d-extensions/Resources/Icon-72.png
--------------------------------------------------------------------------------
/cocos2d-extensions/Resources/Icon@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Seasons7/cocos2d-extensions/HEAD/cocos2d-extensions/Resources/Icon@2x.png
--------------------------------------------------------------------------------
/cocos2d-extensions/Resources/iTunesArtwork:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Seasons7/cocos2d-extensions/HEAD/cocos2d-extensions/Resources/iTunesArtwork
--------------------------------------------------------------------------------
/cocos2d-extensions/Resources/Icon-Small.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Seasons7/cocos2d-extensions/HEAD/cocos2d-extensions/Resources/Icon-Small.png
--------------------------------------------------------------------------------
/cocos2d-extensions/Resources/fps_images.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Seasons7/cocos2d-extensions/HEAD/cocos2d-extensions/Resources/fps_images.png
--------------------------------------------------------------------------------
/cocos2d-extensions/Resources/Icon-Small-50.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Seasons7/cocos2d-extensions/HEAD/cocos2d-extensions/Resources/Icon-Small-50.png
--------------------------------------------------------------------------------
/cocos2d-extensions/Resources/Icon-Small@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Seasons7/cocos2d-extensions/HEAD/cocos2d-extensions/Resources/Icon-Small@2x.png
--------------------------------------------------------------------------------
/cocos2d-extensions/test/CCBumperTest/Resources/Bumper.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Seasons7/cocos2d-extensions/HEAD/cocos2d-extensions/test/CCBumperTest/Resources/Bumper.png
--------------------------------------------------------------------------------
/cocos2d-extensions/test/CCResourceAsyncLoaderTest/Resources/.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Seasons7/cocos2d-extensions/HEAD/cocos2d-extensions/test/CCResourceAsyncLoaderTest/Resources/.jpg
--------------------------------------------------------------------------------
/cocos2d-extensions/test/CCResourceAsyncLoaderTest/Resources/1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Seasons7/cocos2d-extensions/HEAD/cocos2d-extensions/test/CCResourceAsyncLoaderTest/Resources/1.png
--------------------------------------------------------------------------------
/cocos2d-extensions/test/CCResourceAsyncLoaderTest/Resources/2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Seasons7/cocos2d-extensions/HEAD/cocos2d-extensions/test/CCResourceAsyncLoaderTest/Resources/2.png
--------------------------------------------------------------------------------
/cocos2d-extensions/test/CCResourceAsyncLoaderTest/Resources/3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Seasons7/cocos2d-extensions/HEAD/cocos2d-extensions/test/CCResourceAsyncLoaderTest/Resources/3.png
--------------------------------------------------------------------------------
/cocos2d-extensions/test/CCResourceAsyncLoaderTest/Resources/4.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Seasons7/cocos2d-extensions/HEAD/cocos2d-extensions/test/CCResourceAsyncLoaderTest/Resources/4.png
--------------------------------------------------------------------------------
/cocos2d-extensions.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/cocos2d-extensions/test/CCResourceAsyncLoaderTest/CCResourceAsyncLoaderTest.h:
--------------------------------------------------------------------------------
1 | //
2 | // CCResourceAsyncLoaderTest
3 | // cocos2d-extensions
4 | //
5 | // Created by Keisuke Hata on 11/06/22.
6 | //
7 |
8 | #import "cocos2d.h"
9 | #import "ExtensionTest.h"
10 |
11 | @interface CCResourceAsyncLoaderTest : CCLayer
12 | {
13 | }
14 |
15 | @end
16 |
--------------------------------------------------------------------------------
/cocos2d-extensions/RootViewController.h:
--------------------------------------------------------------------------------
1 | //
2 | // RootViewController.h
3 | // cocos2d-extensions
4 | //
5 | // Created by Keisuke Hata on 11/06/22.
6 | // Copyright __MyCompanyName__ 2011. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 |
12 | @interface RootViewController : UIViewController {
13 |
14 | }
15 |
16 | @end
17 |
--------------------------------------------------------------------------------
/cocos2d-extensions/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 |
--------------------------------------------------------------------------------
/cocos2d-extensions/test/CCBumperTest/CCBumperTest.h:
--------------------------------------------------------------------------------
1 | //
2 | // CCBumperTest.h
3 | // cocos2d-extensions
4 | //
5 | // Created by Keisuke Hata on 11/06/25.
6 | //
7 |
8 | #import "cocos2d.h"
9 | #import "CCBumper.h"
10 |
11 | @interface CCBumperCrossFade : CCBumper
12 | + (CCScene *) scene;
13 | @end
14 |
15 | @interface CCBumperTest : CCLayer
16 |
17 | + (CCScene *) scene;
18 |
19 | @end
20 |
--------------------------------------------------------------------------------
/cocos2d-extensions/AppDelegate.h:
--------------------------------------------------------------------------------
1 | //
2 | // AppDelegate.h
3 | // cocos2d-extensions
4 | //
5 | // Created by Keisuke Hata on 11/06/22.
6 | //
7 |
8 | #import
9 |
10 | @class RootViewController;
11 |
12 | @interface AppDelegate : NSObject {
13 | UIWindow *window;
14 | RootViewController *viewController;
15 | }
16 |
17 | @property (nonatomic, retain) UIWindow *window;
18 |
19 | @end
20 |
--------------------------------------------------------------------------------
/cocos2d-extensions/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 |
--------------------------------------------------------------------------------
/cocos2d-extensions/main.m:
--------------------------------------------------------------------------------
1 | //
2 | // main.m
3 | // cocos2d-extensions
4 | //
5 | // Created by Keisuke Hata on 11/06/22.
6 | // Copyright __MyCompanyName__ 2011. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | int main(int argc, char *argv[]) {
12 |
13 | NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
14 | int retVal = UIApplicationMain(argc, argv, nil, @"AppDelegate");
15 | [pool release];
16 | return retVal;
17 | }
18 |
--------------------------------------------------------------------------------
/cocos2d-extensions/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 | }
--------------------------------------------------------------------------------
/cocos2d-extensions/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 |
--------------------------------------------------------------------------------
/cocos2d-extensions/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 |
--------------------------------------------------------------------------------
/cocos2d-extensions/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 |
--------------------------------------------------------------------------------
/cocos2d-extensions/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 |
--------------------------------------------------------------------------------
/cocos2d-extensions/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.
--------------------------------------------------------------------------------
/cocos2d-extensions/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.
--------------------------------------------------------------------------------
/cocos2d-extensions/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 |
--------------------------------------------------------------------------------
/cocos2d-extensions/GameConfig.h:
--------------------------------------------------------------------------------
1 | //
2 | // GameConfig.h
3 | // cocos2d-extensions
4 | //
5 | // Created by Keisuke Hata on 11/06/22.
6 | // Copyright __MyCompanyName__ 2011. All rights reserved.
7 | //
8 |
9 | #ifndef __GAME_CONFIG_H
10 | #define __GAME_CONFIG_H
11 |
12 | //
13 | // Supported Autorotations:
14 | // None,
15 | // UIViewController,
16 | // CCDirector
17 | //
18 | #define kGameAutorotationNone 0
19 | #define kGameAutorotationCCDirector 1
20 | #define kGameAutorotationUIViewController 2
21 |
22 | //
23 | // Define here the type of autorotation that you want for your game
24 | //
25 |
26 | // 3rd generation and newer devices: Rotate using UIViewController. Rotation should be supported on iPad apps.
27 | // TIP:
28 | // To improve the performance, you should set this value to "kGameAutorotationNone" or "kGameAutorotationCCDirector"
29 | #if defined(__ARM_NEON__) || TARGET_IPHONE_SIMULATOR
30 | #define GAME_AUTOROTATION kGameAutorotationUIViewController
31 |
32 | // ARMv6 (1st and 2nd generation devices): Don't rotate. It is very expensive
33 | #elif __arm__
34 | #define GAME_AUTOROTATION kGameAutorotationNone
35 |
36 |
37 | // Ignore this value on Mac
38 | #elif defined(__MAC_OS_X_VERSION_MAX_ALLOWED)
39 |
40 | #else
41 | #error(unknown architecture)
42 | #endif
43 |
44 | #endif // __GAME_CONFIG_H
45 |
46 |
--------------------------------------------------------------------------------
/cocos2d-extensions/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 |
--------------------------------------------------------------------------------
/cocos2d-extensions/extensions/CCBumper.h:
--------------------------------------------------------------------------------
1 | /*
2 | * CCBumper
3 | *
4 | * Copyright (c) 2011 by Keisuke Hata(@Seasons)
5 | * http://d.hatena.ne.jp/Seasons/
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 | #import "cocos2d.h"
27 |
28 | @interface CCBumper : CCLayer {
29 |
30 | }
31 |
32 | + (CCScene *) scene : (NSString *)logoFile;
33 |
34 | @end
35 |
--------------------------------------------------------------------------------
/cocos2d-extensions/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 |
29 | static NSString *version = @"cocos2d v1.0.0-rc3";
30 |
31 | NSString *cocos2dVersion()
32 | {
33 | return version;
34 | }
35 |
--------------------------------------------------------------------------------
/cocos2d-extensions/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 | static NSString *version = @"cocoslive v0.3.2";
31 |
32 | NSString *cocosLiveVersion()
33 | {
34 | return version;
35 | }
36 |
--------------------------------------------------------------------------------
/cocos2d-extensions/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 | seasons.cc.${PRODUCT_NAME:rfc1034identifier}
24 | CFBundleInfoDictionaryVersion
25 | 6.0
26 | CFBundleName
27 | ${PRODUCT_NAME}
28 | CFBundlePackageType
29 | APPL
30 | CFBundleSignature
31 | ????
32 | CFBundleVersion
33 | 1.0
34 | LSRequiresIPhoneOS
35 |
36 | UIPrerenderedIcon
37 |
38 | UIRequiredDeviceCapabilities
39 |
40 | accelerometer
41 |
42 | opengles-1
43 |
44 |
45 | UIStatusBarHidden
46 |
47 |
48 |
49 |
--------------------------------------------------------------------------------
/cocos2d-extensions/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 |
--------------------------------------------------------------------------------
/cocos2d-extensions/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 |
--------------------------------------------------------------------------------
/cocos2d-extensions/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 |
--------------------------------------------------------------------------------
/cocos2d-extensions/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 |
--------------------------------------------------------------------------------
/cocos2d-extensions/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 * cocos2dVersion(void);
44 |
--------------------------------------------------------------------------------
/cocos2d-extensions/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 |
--------------------------------------------------------------------------------
/cocos2d-extensions/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 |
--------------------------------------------------------------------------------
/cocos2d-extensions/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 |
--------------------------------------------------------------------------------
/cocos2d-extensions/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 |
--------------------------------------------------------------------------------
/cocos2d-extensions/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
--------------------------------------------------------------------------------
/cocos2d-extensions/test/CCBumperTest/CCBumperTest.m:
--------------------------------------------------------------------------------
1 | //
2 | // CCBumperTest.m
3 | // cocos2d-extensions
4 | //
5 | // Created by Keisuke Hata on 11/06/25.
6 | //
7 |
8 | #import "CCBumperTest.h"
9 | #import "CCSendMessages.h"
10 | #import "CCBumper.h"
11 |
12 | /* Sample Crossfade CCBumper
13 |
14 | Usage:
15 | AppDelegate.m
16 |
17 | [[CCDirector sharedDirector] replaceScene:[CCBumperCrossFade scene]]
18 |
19 | */
20 |
21 | @implementation CCBumperCrossFade
22 |
23 | + (CCScene *) scene {
24 |
25 | return [CCBumperCrossFade scene:@"Bumper.png"];
26 | }
27 |
28 | - (void) onEnter {
29 |
30 | // Next SceneChange settings
31 | CCSendMessages *message = [CCSendMessages actionWithTarget:[CCDirector sharedDirector]];
32 | CCTransitionCrossFade *crossFade = [CCTransitionCrossFade transitionWithDuration:1.0 scene:[CCBumperTest scene]];
33 | [[CCDirector sharedDirector] replaceScene:crossFade];
34 |
35 | // Create Action
36 | const float fadeDuration = 3.0;
37 | CCSequence *seq = [CCSequence actions:[CCDelayTime actionWithDuration:fadeDuration],message, nil];
38 | [self runAction:seq];
39 |
40 | [super onEnter];
41 | }
42 |
43 | @end
44 |
45 | @implementation CCBumperTest
46 |
47 | + (CCScene *) scene {
48 |
49 | CCScene *scene = [CCScene node];
50 | [scene addChild:[CCBumperTest node]];
51 |
52 | return scene;
53 | }
54 |
55 |
56 | - (id)init
57 | {
58 | self = [super init];
59 | if (self) {
60 |
61 | CGSize size = [[CCDirector sharedDirector] winSize];
62 |
63 | CCLabelTTF *label = [CCLabelTTF labelWithString:@"Hello!!" fontName:@"Marker Felt" fontSize:40];
64 | [self addChild:label];
65 | label.position = ccp(size.width/2,size.height/2);
66 | }
67 |
68 | return self;
69 | }
70 |
71 | @end
72 |
--------------------------------------------------------------------------------
/cocos2d-extensions/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 |
--------------------------------------------------------------------------------
/cocos2d-extensions/extensions/CCResourceAsyncLoader.h:
--------------------------------------------------------------------------------
1 | /*
2 | * CCResourceAsyncLoader
3 | *
4 | * Copyright (c) 2011 by Keisuke Hata(@Seasons)
5 | * http://d.hatena.ne.jp/Seasons/
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 | #import "cocos2d.h"
26 | #import "CCSendMessages.h"
27 |
28 | @interface CCResourceAsyncLoader : CCNode {
29 |
30 | int maxResourceCount_;
31 | int resourceCount_;
32 | NSMutableDictionary *loadResourceLists_;
33 | }
34 |
35 | + (id) loaderWithCount : (int)maxResourceCount;
36 |
37 | - (void) addLoadAsyncTexture :(NSString *)textureFilePath
38 | message:(CCSendMessages *)message;
39 |
40 | @property (nonatomic,readonly) int maxResourceCount;
41 | @property (nonatomic,readwrite) int resourceCount;
42 |
43 | @end
44 |
--------------------------------------------------------------------------------
/cocos2d-extensions/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 |
--------------------------------------------------------------------------------
/cocos2d-extensions/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 |
--------------------------------------------------------------------------------
/cocos2d-extensions/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 |
--------------------------------------------------------------------------------
/cocos2d-extensions/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 |
--------------------------------------------------------------------------------
/cocos2d-extensions/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 |
--------------------------------------------------------------------------------
/cocos2d-extensions/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 |
--------------------------------------------------------------------------------
/cocos2d-extensions/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 |
--------------------------------------------------------------------------------
/cocos2d-extensions/extensions/CCBumper.m:
--------------------------------------------------------------------------------
1 | /*
2 | * CCBumper
3 | *
4 | * Copyright (c) 2011 by Keisuke Hata(@Seasons)
5 | * http://d.hatena.ne.jp/Seasons/
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 | #import "CCBumper.h"
27 |
28 | enum {
29 |
30 | kTag_CCBumper_Logo = 0x1
31 | };
32 |
33 | @interface CCBumper()
34 |
35 | - (CCBumper *) initWithContentsOfFile : (NSString *)logoFile;
36 |
37 | @end
38 |
39 | @implementation CCBumper
40 |
41 | + (CCScene *) scene : (NSString *)logoFile {
42 |
43 | CCScene *scene = [CCScene node];
44 | [scene addChild:[[[self alloc] initWithContentsOfFile:logoFile] autorelease]];
45 |
46 | return scene;
47 | }
48 |
49 | - (CCBumper *) initWithContentsOfFile : (NSString *)logoFile {
50 |
51 | self = [super init];
52 | if( self ) {
53 |
54 | CGSize size = [[CCDirector sharedDirector] winSize];
55 |
56 | CCSprite *logo = [CCSprite spriteWithFile:logoFile];
57 | NSAssert(logo!=nil,@"Can't load CCBumper sprite");
58 |
59 | [self addChild:logo];
60 | logo.tag = kTag_CCBumper_Logo;
61 | logo.position = ccp( size.width/2,size.height/2 );
62 | }
63 | return self;
64 | }
65 |
66 | @end
67 |
--------------------------------------------------------------------------------
/cocos2d-extensions/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 |
--------------------------------------------------------------------------------
/cocos2d-extensions/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 |
--------------------------------------------------------------------------------
/cocos2d-extensions/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 |
--------------------------------------------------------------------------------
/cocos2d-extensions/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 |
--------------------------------------------------------------------------------
/cocos2d-extensions/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 |
--------------------------------------------------------------------------------
/cocos2d-extensions/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 |
--------------------------------------------------------------------------------
/cocos2d-extensions/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 |
--------------------------------------------------------------------------------
/cocos2d-extensions/libs/cocos2d/Support/base64.c:
--------------------------------------------------------------------------------
1 | /*
2 | public domain BASE64 code
3 |
4 | modified for cocos2d-iphone: http://www.cocos2d-iphone.org
5 | */
6 |
7 | #include
8 | #include
9 |
10 | unsigned char alphabet[64] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
11 |
12 | int _base64Decode( unsigned char *input, unsigned int input_len, unsigned char *output, unsigned int *output_len )
13 | {
14 | static char inalphabet[256], decoder[256];
15 | int i, bits, c, char_count, errors = 0;
16 | unsigned int input_idx = 0;
17 | unsigned int output_idx = 0;
18 |
19 | for (i = (sizeof alphabet) - 1; i >= 0 ; i--) {
20 | inalphabet[alphabet[i]] = 1;
21 | decoder[alphabet[i]] = i;
22 | }
23 |
24 | char_count = 0;
25 | bits = 0;
26 | for( input_idx=0; input_idx < input_len ; input_idx++ ) {
27 | c = input[ input_idx ];
28 | if (c == '=')
29 | break;
30 | if (c > 255 || ! inalphabet[c])
31 | continue;
32 | bits += decoder[c];
33 | char_count++;
34 | if (char_count == 4) {
35 | output[ output_idx++ ] = (bits >> 16);
36 | output[ output_idx++ ] = ((bits >> 8) & 0xff);
37 | output[ output_idx++ ] = ( bits & 0xff);
38 | bits = 0;
39 | char_count = 0;
40 | } else {
41 | bits <<= 6;
42 | }
43 | }
44 |
45 | if( c == '=' ) {
46 | switch (char_count) {
47 | case 1:
48 | fprintf(stderr, "base64Decode: encoding incomplete: at least 2 bits missing");
49 | errors++;
50 | break;
51 | case 2:
52 | output[ output_idx++ ] = ( bits >> 10 );
53 | break;
54 | case 3:
55 | output[ output_idx++ ] = ( bits >> 16 );
56 | output[ output_idx++ ] = (( bits >> 8 ) & 0xff);
57 | break;
58 | }
59 | } else if ( input_idx < input_len ) {
60 | if (char_count) {
61 | fprintf(stderr, "base64 encoding incomplete: at least %d bits truncated",
62 | ((4 - char_count) * 6));
63 | errors++;
64 | }
65 | }
66 |
67 | *output_len = output_idx;
68 | return errors;
69 | }
70 |
71 | int base64Decode(unsigned char *in, unsigned int inLength, unsigned char **out)
72 | {
73 | unsigned int outLength = 0;
74 |
75 | //should be enough to store 6-bit buffers in 8-bit buffers
76 | *out = malloc( inLength * 3.0f / 4.0f + 1 );
77 | if( *out ) {
78 | int ret = _base64Decode(in, inLength, *out, &outLength);
79 |
80 | if (ret > 0 )
81 | {
82 | printf("Base64Utils: error decoding");
83 | free(*out);
84 | *out = NULL;
85 | outLength = 0;
86 | }
87 | }
88 | return outLength;
89 | }
90 |
--------------------------------------------------------------------------------
/cocos2d-extensions/ExtensionTest.h:
--------------------------------------------------------------------------------
1 | /*
2 | * cocos2d-extensions
3 | * https://github.com/cocos2d/cocos2d-iphone-extensions
4 | *
5 | * Copyright (c) 2011 Stepan Generalov
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 "cocos2d.h"
28 |
29 | #define SYNTHESIZE_EXTENSION_TEST(TEST_LAYER) \
30 | \
31 | @implementation ExtensionTest \
32 | \
33 | +(CCScene *) scene \
34 | { \
35 | CCScene *scene = [CCScene node]; \
36 | [scene addChild: [TEST_LAYER node]]; \
37 | return scene; \
38 | } \
39 | \
40 | + (BOOL) isRetinaDisplaySupported \
41 | { \
42 | return YES; \
43 | } \
44 | \
45 | @end \
46 |
47 | #define SYNTHESIZE_EXTENSION_TEST_WITHOUT_RETINA(TEST_LAYER) \
48 | \
49 | @implementation ExtensionTest \
50 | \
51 | +(CCScene *) scene \
52 | { \
53 | CCScene *scene = [CCScene node]; \
54 | [scene addChild: [TEST_LAYER node]]; \
55 | return scene; \
56 | } \
57 | \
58 | +(BOOL) isRetinaDisplaySupported \
59 | { \
60 | return YES; \
61 | } \
62 | \
63 | @end \
64 |
65 | // ExtensionTest - Interface
66 | // Implementation differs in different ExtensionTests
67 | @interface ExtensionTest : CCLayer
68 | {
69 | }
70 |
71 | // Returns a CCScene that contains the test layer.
72 | +(CCScene *) scene;
73 |
74 | +(BOOL) isRetinaDisplaySupported;
75 |
76 | @end
77 |
--------------------------------------------------------------------------------
/cocos2d-extensions/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 |
--------------------------------------------------------------------------------
/cocos2d-extensions/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 |
--------------------------------------------------------------------------------
/cocos2d-extensions/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 |
--------------------------------------------------------------------------------
/cocos2d-extensions/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 |
--------------------------------------------------------------------------------
/cocos2d-extensions/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 |
--------------------------------------------------------------------------------
/cocos2d-extensions/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 |
--------------------------------------------------------------------------------
/cocos2d-extensions/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 |
--------------------------------------------------------------------------------
/cocos2d-extensions/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 |
--------------------------------------------------------------------------------
/cocos2d-extensions/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 |
--------------------------------------------------------------------------------
/cocos2d-extensions/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 |
--------------------------------------------------------------------------------
/cocos2d-extensions/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 |
--------------------------------------------------------------------------------
/cocos2d-extensions/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 |
--------------------------------------------------------------------------------
/cocos2d-extensions/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 |
--------------------------------------------------------------------------------
/README:
--------------------------------------------------------------------------------
1 | cocos2d-extensions made by Seasons
2 |
3 | - CCBumper
4 | - CCResourceAsyncLoader
5 |
6 | CCBumper is simple splash logo animation.
7 |
8 | For example:CCBumperCrossFade
9 | >>>>
10 | =======================================================
11 | Usage:
12 | AppDelegate.m
13 |
14 | // only this code. easy!
15 | [[CCDirector sharedDirector] replaceScene:[CCBumperCrossFade scene]];
16 | =======================================================
17 |
18 | @implementation CCBumperCrossFade
19 |
20 | + (CCScene *) scene {
21 |
22 | return [CCBumperCrossFade scene:@"Bumper.png"];
23 | }
24 |
25 | - (void) onEnter {
26 |
27 | // Next SceneChange settings
28 | CCSendMessages *message = [CCSendMessages actionWithTarget:[CCDirector sharedDirector]];
29 | CCTransitionCrossFade *crossFade = [CCTransitionCrossFade transitionWithDuration:1.0 scene:[CCBumperTest scene]];
30 | [[CCDirector sharedDirector] replaceScene:crossFade];
31 |
32 | // Create Action
33 | const float fadeDuration = 3.0;
34 | CCSequence *seq = [CCSequence actions:[CCDelayTime actionWithDuration:fadeDuration],message, nil];
35 | [self runAction:seq];
36 |
37 | [super onEnter];
38 | }
39 |
40 | @end
41 | <<<<
42 |
43 | CCResouceAsyncLoader is simple and easy class to asynchronous load your resources.
44 |
45 | >>>>
46 | -(id) init
47 | {
48 | if( (self=[super init])) {
49 |
50 | // CCResourceAsyncLoader setup
51 | loader = [CCResourceAsyncLoader loaderWithCount:[resourceNames count]];
52 | loader.tag = kTag_CCRAL_Test_Loader; // you can get loader class in other selector.
53 |
54 | // regist load resource file
55 | for (NSString *path in resourceNames) {
56 | [loader addLoadAsyncTexture:path message:message];
57 | }
58 | // execute loader
59 | [self addChild:loader];
60 | }
61 | return self;
62 | }
63 |
64 | - (void) loadComplete {
65 |
66 | // You can get loader by CCNode tag.
67 | CCNode *obj = [self getChildByTag:kTag_CCRAL_Test_Loader];
68 | NSAssert([obj isKindOfClass:[CCResourceAsyncLoader class]],@"Not CCResourceAsyncLoader");
69 |
70 | CCResourceAsyncLoader *loader = (CCResourceAsyncLoader *)obj;
71 | /****************************************************/
72 | /* [Important] Decrement resource count. */
73 | loader.resourceCount--;
74 | /****************************************************/
75 |
76 | // Load Complete!!
77 | if( loader.resourceCount == 0 ) {
78 |
79 | /* write next scene jump code */
80 | /* for example
81 |
82 | CCSendMessages *message = [CCSendMessages actionWithTarget:[CCDirector sharedDirector]];
83 |
84 | // to Next Scene Action
85 | [[message addMessage] replaceScene:[CCTransitionCrossFade
86 | transitionWithDuration:1.0
87 | scene:[CCResourceAsyncLoaderTest scene]]];
88 | [self runAction:message];
89 | */
90 | }
91 |
92 | /* Update progress bar or message!! */
93 | /*
94 | write code here
95 | */
96 | }
97 | <<<<
98 |
--------------------------------------------------------------------------------
/cocos2d-extensions/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 CCBitmapFontAtlas. 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 | 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:(int)w itemHeight:(int)h startCharMap:(char)c;
54 |
55 | /** 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.
56 | @deprecated Will be removed in 1.0.1. Use "labelWithString:" instead
57 | */
58 | +(id) labelAtlasWithString:(NSString*) string charMapFile: (NSString*) charmapfile itemWidth:(int)w itemHeight:(int)h startCharMap:(char)c DEPRECATED_ATTRIBUTE;
59 |
60 | /** 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 */
61 | -(id) initWithString:(NSString*) string charMapFile: (NSString*) charmapfile itemWidth:(int)w itemHeight:(int)h startCharMap:(char)c;
62 | @end
63 |
--------------------------------------------------------------------------------
/cocos2d-extensions/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 |
--------------------------------------------------------------------------------
/cocos2d-extensions/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 |
--------------------------------------------------------------------------------
/cocos2d-extensions/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 |
--------------------------------------------------------------------------------
/cocos2d-extensions/extensions/CCResourceAsyncLoader.m:
--------------------------------------------------------------------------------
1 | /*
2 | * CCResourceAsyncLoader
3 | *
4 | * Copyright (c) 2011 by Keisuke Hata(@Seasons)
5 | * http://d.hatena.ne.jp/Seasons/
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 | #import "CCResourceAsyncLoader.h"
27 |
28 | @interface CCResourceAsyncLoader()
29 | - (id) initWithCount:(int)maxResourceCount;
30 | @end
31 |
32 | @implementation CCResourceAsyncLoader
33 |
34 | @synthesize maxResourceCount = maxResourceCount_;
35 | @synthesize resourceCount = resourceCount_;
36 |
37 | + (id) loaderWithCount : (int)maxResourceCount {
38 |
39 | return [[[self alloc] initWithCount:maxResourceCount] autorelease];
40 | }
41 |
42 | - (id) initWithCount:(int)maxResourceCount {
43 |
44 | self = [super init];
45 | if( self ) {
46 |
47 | resourceCount_ = 0;
48 | maxResourceCount_ = maxResourceCount;
49 | loadResourceLists_ = [[NSMutableDictionary alloc] init];
50 | }
51 | return self;
52 | }
53 |
54 | - (void) addLoadAsyncTexture :(NSString *)textureFilePath
55 | message:(CCSendMessages *)message {
56 |
57 | NSAssert( resourceCount_ < maxResourceCount_ , @"Load ResourceCount over!!" );
58 | NSAssert( [loadResourceLists_ objectForKey:textureFilePath]==nil , @"Key already exists!!" );
59 |
60 | resourceCount_ ++;
61 | [loadResourceLists_ setObject:message forKey:textureFilePath];
62 | }
63 |
64 | - (void) onEnter {
65 |
66 | NSArray *keys = [loadResourceLists_ allKeys];
67 | for (NSString *key in keys) {
68 | [[CCTextureCache sharedTextureCache] addImageAsync:key
69 | target:[loadResourceLists_ objectForKey:key]
70 | selector:@selector(execute)];
71 | }
72 | [super onEnter];
73 | }
74 |
75 | - (void) onExit {
76 |
77 | // [IMPORTANT]
78 | // loadResourceLists have retain object, so you must release in onExit.
79 | // Otherwise , dealloc method never be called.
80 | [loadResourceLists_ release];
81 | [super onExit];
82 | }
83 |
84 | @end
85 |
--------------------------------------------------------------------------------
/cocos2d-extensions/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 |
--------------------------------------------------------------------------------
/cocos2d-extensions/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 |
--------------------------------------------------------------------------------
/cocos2d-extensions/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 |
--------------------------------------------------------------------------------
/cocos2d-extensions/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 |
--------------------------------------------------------------------------------
/cocos2d-extensions/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 |
--------------------------------------------------------------------------------
/cocos2d-extensions/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
--------------------------------------------------------------------------------
/cocos2d-extensions/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 |
--------------------------------------------------------------------------------
/cocos2d-extensions/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 |
--------------------------------------------------------------------------------
/cocos2d-extensions/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 |
--------------------------------------------------------------------------------
/cocos2d-extensions/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 |
--------------------------------------------------------------------------------
/cocos2d-extensions/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 |
--------------------------------------------------------------------------------
/cocos2d-extensions/extensions/CCSendMessages.h:
--------------------------------------------------------------------------------
1 | /*
2 | * CCSendMessages
3 | *
4 | * cocos2d-extensions
5 | * https://github.com/cocos2d/cocos2d-iphone-extensions
6 | *
7 | * Copyright (c) 2011 by Darren Clark
8 | * http://darrenclark.ca/
9 | *
10 | * Permission is hereby granted, free of charge, to any person obtaining a copy
11 | * of this software and associated documentation files (the "Software"), to deal
12 | * in the Software without restriction, including without limitation the rights
13 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14 | * copies of the Software, and to permit persons to whom the Software is
15 | * furnished to do so, subject to the following conditions:
16 | *
17 | * The above copyright notice and this permission notice shall be included in
18 | * all copies or substantial portions of the Software.
19 | *
20 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
23 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
25 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
26 | * THE SOFTWARE.
27 | *
28 | */
29 |
30 | #import
31 | #import "cocos2d.h"
32 |
33 | @class CCStoredMessages;
34 |
35 | // CCSendMessages
36 | // CCActionInstant that sends messsages to a target
37 | // when it is run
38 | //
39 | // It is different than the CCCallFunc* classes in
40 | // that any message can be sent to a target
41 | // regardless of the number/type of arguments.
42 | //
43 | // NOTE: Any selector in the NSObject class and
44 | // any selector in the NSObject and NSCopying
45 | // protocals cannot be added via -addMessage.
46 | // If you need to call one of those selectors,
47 | // create an NSInvocation and add it via
48 | // -addInvocation:.
49 | //
50 | // Usage:
51 | // Create a CCSendMessages instance with
52 | // a target using -initWithTarget: or
53 | // +actionWithTarget:
54 | //
55 | // Add message call(s) to it:
56 | // (assuming sendMessages is your CCSendMessages object)
57 | // [[sendMessages addMessage] setOpacity:0.5];
58 | // [[sendMessages addMessage] long:0.5 selector:obj example:ccp(3,3)];
59 | //
60 | // Run it on a CCNode with -runAction:, or add it to a
61 | // CCSequence to run it later on!
62 | //
63 | // Also, arguments don't have to be Objective-C objectss
64 |
65 | @interface CCSendMessages : CCActionInstant {
66 |
67 | @private
68 | id messagesTarget_;
69 | CCStoredMessages *messages_;
70 |
71 | }
72 |
73 | + (id)actionWithTarget:(id)t;
74 | - (id)initWithTarget:(id)t;
75 |
76 | - (id)addMessage;
77 | - (void)addInvocation:(NSInvocation *)invocation;
78 | - (void)execute;
79 |
80 | @end
81 |
82 |
83 | // CCStoredMessages
84 | // Simply a class to capture messages sent to it
85 | //
86 | // Public ivars are used instead of properties so
87 | // that a wider range of selectors can be used
88 | // (because this class cannot capture selectors it
89 | // responds to). Also, because of this, most logic
90 | // is handled in CCSendMessages
91 |
92 | @interface CCStoredMessages : NSObject {
93 |
94 | @public
95 | id target_;
96 | NSMutableArray *invocations_;
97 |
98 | }
99 |
100 | @end
--------------------------------------------------------------------------------
/cocos2d-extensions/libs/cocos2d/CCAtlasNode.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 | *
8 | * Permission is hereby granted, free of charge, to any person obtaining a copy
9 | * of this software and associated documentation files (the "Software"), to deal
10 | * in the Software without restriction, including without limitation the rights
11 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12 | * copies of the Software, and to permit persons to whom the Software is
13 | * furnished to do so, subject to the following conditions:
14 | *
15 | * The above copyright notice and this permission notice shall be included in
16 | * all copies or substantial portions of the Software.
17 | *
18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24 | * THE SOFTWARE.
25 | */
26 |
27 |
28 | #import "CCTextureAtlas.h"
29 | #import "CCNode.h"
30 | #import "CCProtocols.h"
31 |
32 | /** CCAtlasNode is a subclass of CCNode that implements the CCRGBAProtocol and
33 | CCTextureProtocol protocol
34 |
35 | It knows how to render a TextureAtlas object.
36 | If you are going to render a TextureAtlas consider subclassing CCAtlasNode (or a subclass of CCAtlasNode)
37 |
38 | All features from CCNode are valid, plus the following features:
39 | - opacity and RGB colors
40 | */
41 | @interface CCAtlasNode : CCNode
42 | {
43 | // texture atlas
44 | CCTextureAtlas *textureAtlas_;
45 |
46 | // chars per row
47 | NSUInteger itemsPerRow_;
48 | // chars per column
49 | NSUInteger itemsPerColumn_;
50 |
51 | // width of each char
52 | NSUInteger itemWidth_;
53 | // height of each char
54 | NSUInteger itemHeight_;
55 |
56 | // blend function
57 | ccBlendFunc blendFunc_;
58 |
59 | // texture RGBA.
60 | GLubyte opacity_;
61 | ccColor3B color_;
62 | ccColor3B colorUnmodified_;
63 | BOOL opacityModifyRGB_;
64 | }
65 |
66 | /** conforms to CCTextureProtocol protocol */
67 | @property (nonatomic,readwrite,retain) CCTextureAtlas *textureAtlas;
68 |
69 | /** conforms to CCTextureProtocol protocol */
70 | @property (nonatomic,readwrite) ccBlendFunc blendFunc;
71 |
72 | /** conforms to CCRGBAProtocol protocol */
73 | @property (nonatomic,readwrite) GLubyte opacity;
74 | /** conforms to CCRGBAProtocol protocol */
75 | @property (nonatomic,readwrite) ccColor3B color;
76 |
77 |
78 | /** creates a CCAtlasNode with an Atlas file the width and height of each item measured in points and the quantity of items to render*/
79 | +(id) atlasWithTileFile:(NSString*)tile tileWidth:(NSUInteger)w tileHeight:(NSUInteger)h itemsToRender: (NSUInteger) c;
80 |
81 | /** initializes an CCAtlasNode with an Atlas file the width and height of each item measured in points and the quantity of items to render*/
82 | -(id) initWithTileFile:(NSString*)tile tileWidth:(NSUInteger)w tileHeight:(NSUInteger)h itemsToRender: (NSUInteger) c;
83 |
84 | /** updates the Atlas (indexed vertex array).
85 | * Shall be overriden in subclasses
86 | */
87 | -(void) updateAtlasValues;
88 | @end
89 |
--------------------------------------------------------------------------------
/cocos2d-extensions/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 |
--------------------------------------------------------------------------------
/cocos2d-extensions/libs/cocos2d/CCTransitionPageTurn.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 |
27 | #import "CCTransitionPageTurn.h"
28 | #import "CCActionPageTurn3D.h"
29 | #import "CCDirector.h"
30 |
31 | @implementation CCTransitionPageTurn
32 |
33 | /** creates a base transition with duration and incoming scene */
34 | +(id) transitionWithDuration:(ccTime) t scene:(CCScene*)s backwards:(BOOL) back
35 | {
36 | return [[[self alloc] initWithDuration:t scene:s backwards:back] autorelease];
37 | }
38 |
39 | /** initializes a transition with duration and incoming scene */
40 | -(id) initWithDuration:(ccTime) t scene:(CCScene*)s backwards:(BOOL) back
41 | {
42 | // XXX: needed before [super init]
43 | back_ = back;
44 |
45 | if( ( self = [super initWithDuration:t scene:s] ) )
46 | {
47 | // do something
48 | }
49 | return self;
50 | }
51 |
52 | -(void) sceneOrder
53 | {
54 | inSceneOnTop_ = back_;
55 | }
56 |
57 | //
58 | -(void) onEnter
59 | {
60 | [super onEnter];
61 |
62 | CGSize s = [[CCDirector sharedDirector] winSize];
63 | int x, y;
64 | if( s.width > s.height)
65 | {
66 | x = 16;
67 | y = 12;
68 | }
69 | else
70 | {
71 | x = 12;
72 | y = 16;
73 | }
74 |
75 | id action = [self actionWithSize:ccg(x,y)];
76 |
77 | if(! back_ )
78 | {
79 | [outScene_ runAction: [CCSequence actions:
80 | action,
81 | [CCCallFunc actionWithTarget:self selector:@selector(finish)],
82 | [CCStopGrid action],
83 | nil]
84 | ];
85 | }
86 | else
87 | {
88 | // to prevent initial flicker
89 | inScene_.visible = NO;
90 | [inScene_ runAction: [CCSequence actions:
91 | [CCShow action],
92 | action,
93 | [CCCallFunc actionWithTarget:self selector:@selector(finish)],
94 | [CCStopGrid action],
95 | nil]
96 | ];
97 | }
98 |
99 | }
100 |
101 | -(CCActionInterval*) actionWithSize: (ccGridSize) v
102 | {
103 | if( back_ )
104 | {
105 | // Get hold of the PageTurn3DAction
106 | return [CCReverseTime actionWithAction:
107 | [CCPageTurn3D actionWithSize:v duration:duration_]];
108 | }
109 | else
110 | {
111 | // Get hold of the PageTurn3DAction
112 | return [CCPageTurn3D actionWithSize:v duration:duration_];
113 | }
114 | }
115 |
116 | @end
117 |
118 |
--------------------------------------------------------------------------------
/cocos2d-extensions/test/CCResourceAsyncLoaderTest/CCResourceAsyncLoaderTest.m:
--------------------------------------------------------------------------------
1 | //
2 | // CCResourceAsyncLoaderTest.m
3 | // cocos2d-extensions
4 | //
5 | // Created by Keisuke Hata on 11/06/22.
6 | //
7 |
8 |
9 | // Import the interfaces
10 | #import "CCResourceAsyncLoaderTest.h"
11 | #import "CCResourceAsyncLoader.h"
12 |
13 | SYNTHESIZE_EXTENSION_TEST(CCResourceAsyncLoaderTest)
14 |
15 | enum {
16 |
17 | kTag_CCRAL_Test_Loader = 0x1,
18 | kTag_CCRAL_Test_Label
19 | };
20 |
21 | @interface CCResourceAsyncLoaderTest()
22 |
23 | - (void) loadComplete;
24 |
25 | @end
26 |
27 | @implementation CCResourceAsyncLoaderTest
28 |
29 | -(id) init
30 | {
31 | if( (self=[super init])) {
32 |
33 | CCLabelTTF *label = [CCLabelTTF labelWithString:@" " fontName:@"Marker Felt" fontSize:24];
34 |
35 | // Setup CCResourceAsyncLoader
36 | CCResourceAsyncLoader *loader = nil;
37 |
38 | NSArray *resourceNames = [NSArray arrayWithObjects:
39 | @"1.png",
40 | @"2.png",
41 | @"3.png",
42 | @"4.png",
43 | nil];
44 |
45 | // Loading label
46 | NSString *s = [NSString stringWithFormat:@"Now Loading...[%d]",[resourceNames count]];
47 | [label setString:s];
48 | label.tag = kTag_CCRAL_Test_Label;
49 | label.position = ccp(160,40);
50 | [self addChild:label];
51 |
52 | // Load finished selector
53 | CCSendMessages *message = [CCSendMessages actionWithTarget:self];
54 | [[message addMessage] loadComplete];
55 |
56 | // CCResourceAsyncLoader setup
57 | loader = [CCResourceAsyncLoader loaderWithCount:[resourceNames count]];
58 | loader.tag = kTag_CCRAL_Test_Loader;
59 |
60 | // regist load resource file
61 | for (NSString *path in resourceNames) {
62 | [loader addLoadAsyncTexture:path message:message];
63 | }
64 | // execute loader
65 | [self addChild:loader];
66 | }
67 | return self;
68 | }
69 |
70 | - (void) loadComplete {
71 |
72 | CCNode *obj = [self getChildByTag:kTag_CCRAL_Test_Loader];
73 | NSAssert([obj isKindOfClass:[CCResourceAsyncLoader class]],@"Not CCResourceAsyncLoader");
74 |
75 | CCResourceAsyncLoader *loader = (CCResourceAsyncLoader *)obj;
76 | loader.resourceCount--;
77 | CCLOG(@"count:%d",loader.resourceCount);
78 |
79 | // Load Complete!!
80 | if( loader.resourceCount == 0 ) {
81 |
82 | /* write next scene jump code */
83 | /* for example
84 |
85 | CCSendMessages *message = [CCSendMessages actionWithTarget:[CCDirector sharedDirector]];
86 |
87 | // to Next Scene Action
88 | [[message addMessage] replaceScene:[CCTransitionCrossFade
89 | transitionWithDuration:1.0
90 | scene:[CCResourceAsyncLoaderTest scene]]];
91 | [self runAction:message];
92 | */
93 | }
94 |
95 | CCLabelTTF *label = (CCLabelTTF *)[self getChildByTag:kTag_CCRAL_Test_Label];
96 | NSAssert(label!=nil,@"label is nil");
97 | NSString *s = [NSString stringWithFormat:@"Now Loading...[%d]",loader.resourceCount];
98 | [label setString:s];
99 | CCLOG(@"TextureLoaded...");
100 | }
101 |
102 | - (void) dealloc
103 | {
104 | [super dealloc];
105 | }
106 |
107 | @end
108 |
--------------------------------------------------------------------------------
/cocos2d-extensions/libs/cocos2d/CCCamera.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 | /**
31 | A CCCamera is used in every CCNode.
32 | Useful to look at the object from different views.
33 | The OpenGL gluLookAt() function is used to locate the
34 | camera.
35 |
36 | If the object is transformed by any of the scale, rotation or
37 | position attributes, then they will override the camera.
38 |
39 | IMPORTANT: Either your use the camera or the rotation/scale/position properties. You can't use both.
40 | World coordinates won't work if you use the camera.
41 |
42 | Limitations:
43 |
44 | - Some nodes, like CCParallaxNode, CCParticle uses world node coordinates, and they won't work properly if you move them (or any of their ancestors)
45 | using the camera.
46 |
47 | - It doesn't work on batched nodes like CCSprite objects when they are parented to a CCSpriteBatchNode object.
48 |
49 | - It is recommended to use it ONLY if you are going to create 3D effects. For 2D effecs, use the action CCFollow or position/scale/rotate.
50 |
51 | */
52 |
53 | @interface CCCamera : NSObject
54 | {
55 | float eyeX_;
56 | float eyeY_;
57 | float eyeZ_;
58 |
59 | float centerX_;
60 | float centerY_;
61 | float centerZ_;
62 |
63 | float upX_;
64 | float upY_;
65 | float upZ_;
66 |
67 | BOOL dirty_;
68 | }
69 |
70 | /** whether of not the camera is dirty */
71 | @property (nonatomic,readwrite) BOOL dirty;
72 |
73 | /** returns the Z eye */
74 | +(float) getZEye;
75 |
76 | /** sets the camera in the defaul position */
77 | -(void) restore;
78 | /** Sets the camera using gluLookAt using its eye, center and up_vector */
79 | -(void) locate;
80 | /** sets the eye values in points */
81 | -(void) setEyeX: (float)x eyeY:(float)y eyeZ:(float)z;
82 | /** sets the center values in points */
83 | -(void) setCenterX: (float)x centerY:(float)y centerZ:(float)z;
84 | /** sets the up values */
85 | -(void) setUpX: (float)x upY:(float)y upZ:(float)z;
86 |
87 | /** get the eye vector values in points */
88 | -(void) eyeX:(float*)x eyeY:(float*)y eyeZ:(float*)z;
89 | /** get the center vector values in points */
90 | -(void) centerX:(float*)x centerY:(float*)y centerZ:(float*)z;
91 | /** get the up vector values */
92 | -(void) upX:(float*)x upY:(float*)y upZ:(float*)z;
93 |
94 |
95 | @end
96 |
--------------------------------------------------------------------------------
/cocos2d-extensions/libs/CocosDenshion/CDOpenALSupport.h:
--------------------------------------------------------------------------------
1 | /*
2 |
3 | Disclaimer: IMPORTANT: This Apple software is supplied to you by
4 | Apple Inc. ("Apple") in consideration of your agreement to the
5 | following terms, and your use, installation, modification or
6 | redistribution of this Apple software constitutes acceptance of these
7 | terms. If you do not agree with these terms, please do not use,
8 | install, modify or redistribute this Apple software.
9 |
10 | In consideration of your agreement to abide by the following terms, and
11 | subject to these terms, Apple grants you a personal, non-exclusive
12 | license, under Apple's copyrights in this original Apple software (the
13 | "Apple Software"), to use, reproduce, modify and redistribute the Apple
14 | Software, with or without modifications, in source and/or binary forms;
15 | provided that if you redistribute the Apple Software in its entirety and
16 | without modifications, you must retain this notice and the following
17 | text and disclaimers in all such redistributions of the Apple Software.
18 | Neither the name, trademarks, service marks or logos of Apple Inc.
19 | may be used to endorse or promote products derived from the Apple
20 | Software without specific prior written permission from Apple. Except
21 | as expressly stated in this notice, no other rights or licenses, express
22 | or implied, are granted by Apple herein, including but not limited to
23 | any patent rights that may be infringed by your derivative works or by
24 | other works in which the Apple Software may be incorporated.
25 |
26 | The Apple Software is provided by Apple on an "AS IS" basis. APPLE
27 | MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
28 | THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS
29 | FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND
30 | OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
31 |
32 | IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL
33 | OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
34 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
35 | INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION,
36 | MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED
37 | AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),
38 | STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
39 | POSSIBILITY OF SUCH DAMAGE.
40 |
41 | Copyright (C) 2009 Apple Inc. All Rights Reserved.
42 |
43 | $Id$
44 | */
45 |
46 | /*
47 | This file contains code from version 1.1 and 1.4 of MyOpenALSupport.h taken from Apple's oalTouch version.
48 | The 1.4 version code is used for loading IMA4 files, however, this code causes very noticeable clicking
49 | when used to load wave files that are looped so the 1.1 version code is used specifically for loading
50 | wav files.
51 | */
52 |
53 | #ifndef __CD_OPENAL_H
54 | #define __CD_OPENAL_H
55 |
56 | #ifdef __cplusplus
57 | extern "C" {
58 | #endif
59 |
60 |
61 | #import
62 | #import
63 | #import
64 |
65 |
66 | //Taken from oalTouch MyOpenALSupport 1.1
67 | void* CDloadWaveAudioData(CFURLRef inFileURL, ALsizei *outDataSize, ALenum *outDataFormat, ALsizei* outSampleRate);
68 | void* CDloadCafAudioData(CFURLRef inFileURL, ALsizei *outDataSize, ALenum *outDataFormat, ALsizei* outSampleRate);
69 | void* CDGetOpenALAudioData(CFURLRef inFileURL, ALsizei *outDataSize, ALenum *outDataFormat, ALsizei* outSampleRate);
70 |
71 | #ifdef __cplusplus
72 | }
73 | #endif
74 |
75 | #endif
76 |
77 |
78 |
--------------------------------------------------------------------------------
/cocos2d-extensions/libs/FontLabel/FontManager.h:
--------------------------------------------------------------------------------
1 | //
2 | // FontManager.h
3 | // FontLabel
4 | //
5 | // Created by Kevin Ballard on 5/5/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 |
27 | @interface FontManager : NSObject {
28 | CFMutableDictionaryRef fonts;
29 | NSMutableDictionary *urls;
30 | }
31 | + (FontManager *)sharedManager;
32 | /*!
33 | @method
34 | @abstract Loads a TTF font from the main bundle
35 | @param filename The name of the font file to load (with or without extension).
36 | @return YES if the font was loaded, NO if an error occurred
37 | @discussion If the font has already been loaded, this method does nothing and returns YES.
38 | This method first attempts to load the font by appending .ttf to the filename.
39 | If that file does not exist, it tries the filename exactly as given.
40 | */
41 | - (BOOL)loadFont:(NSString *)filename;
42 | /*!
43 | @method
44 | @abstract Loads a font from the given file URL
45 | @param url A file URL that points to a font file
46 | @return YES if the font was loaded, NO if an error occurred
47 | @discussion If the font has already been loaded, this method does nothing and returns YES.
48 | */
49 | - (BOOL)loadFontURL:(NSURL *)url;
50 | /*!
51 | @method
52 | @abstract Returns the loaded font with the given filename
53 | @param filename The name of the font file that was given to -loadFont:
54 | @return A CGFontRef, or NULL if the specified font cannot be found
55 | @discussion If the font has not been loaded yet, -loadFont: will be
56 | called with the given name first.
57 | */
58 | - (CGFontRef)fontWithName:(NSString *)filename __AVAILABILITY_INTERNAL_DEPRECATED;
59 | /*!
60 | @method
61 | @abstract Returns a ZFont object corresponding to the loaded font with the given filename and point size
62 | @param filename The name of the font file that was given to -loadFont:
63 | @param pointSize The point size of the font
64 | @return A ZFont, or NULL if the specified font cannot be found
65 | @discussion If the font has not been loaded yet, -loadFont: will be
66 | called with the given name first.
67 | */
68 | - (ZFont *)zFontWithName:(NSString *)filename pointSize:(CGFloat)pointSize;
69 | /*!
70 | @method
71 | @abstract Returns a ZFont object corresponding to the loaded font with the given file URL and point size
72 | @param url A file URL that points to a font file
73 | @param pointSize The point size of the font
74 | @return A ZFont, or NULL if the specified font cannot be loaded
75 | @discussion If the font has not been loaded yet, -loadFontURL: will be called with the given URL first.
76 | */
77 | - (ZFont *)zFontWithURL:(NSURL *)url pointSize:(CGFloat)pointSize;
78 | /*!
79 | @method
80 | @abstract Returns a CFArrayRef of all loaded CGFont objects
81 | @return A CFArrayRef of all loaded CGFont objects
82 | @description You are responsible for releasing the CFArrayRef
83 | */
84 | - (CFArrayRef)copyAllFonts;
85 | @end
86 |
--------------------------------------------------------------------------------
/cocos2d-extensions/libs/cocos2d/CCCamera.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 "Platforms/CCGL.h"
28 | #import "CCCamera.h"
29 | #import "ccMacros.h"
30 | #import "CCDrawingPrimitives.h"
31 |
32 | @implementation CCCamera
33 |
34 | @synthesize dirty = dirty_;
35 |
36 | -(id) init
37 | {
38 | if( (self=[super init]) )
39 | [self restore];
40 |
41 | return self;
42 | }
43 |
44 | - (NSString*) description
45 | {
46 | return [NSString stringWithFormat:@"<%@ = %08X | center = (%.2f,%.2f,%.2f)>", [self class], self, centerX_, centerY_, centerZ_];
47 | }
48 |
49 |
50 | - (void) dealloc
51 | {
52 | CCLOGINFO(@"cocos2d: deallocing %@", self);
53 | [super dealloc];
54 | }
55 |
56 | -(void) restore
57 | {
58 | eyeX_ = eyeY_ = 0;
59 | eyeZ_ = [CCCamera getZEye];
60 |
61 | centerX_ = centerY_ = centerZ_ = 0;
62 |
63 | upX_ = 0.0f;
64 | upY_ = 1.0f;
65 | upZ_ = 0.0f;
66 |
67 | dirty_ = NO;
68 | }
69 |
70 | -(void) locate
71 | {
72 | if( dirty_ )
73 | gluLookAt( eyeX_, eyeY_, eyeZ_,
74 | centerX_, centerY_, centerZ_,
75 | upX_, upY_, upZ_
76 | );
77 | }
78 |
79 | +(float) getZEye
80 | {
81 | return FLT_EPSILON;
82 | // CGSize s = [[CCDirector sharedDirector] displaySize];
83 | // return ( s.height / 1.1566f );
84 | }
85 |
86 | -(void) setEyeX: (float)x eyeY:(float)y eyeZ:(float)z
87 | {
88 | eyeX_ = x * CC_CONTENT_SCALE_FACTOR();
89 | eyeY_ = y * CC_CONTENT_SCALE_FACTOR();
90 | eyeZ_ = z * CC_CONTENT_SCALE_FACTOR();
91 | dirty_ = YES;
92 | }
93 |
94 | -(void) setCenterX: (float)x centerY:(float)y centerZ:(float)z
95 | {
96 | centerX_ = x * CC_CONTENT_SCALE_FACTOR();
97 | centerY_ = y * CC_CONTENT_SCALE_FACTOR();
98 | centerZ_ = z * CC_CONTENT_SCALE_FACTOR();
99 | dirty_ = YES;
100 | }
101 |
102 | -(void) setUpX: (float)x upY:(float)y upZ:(float)z
103 | {
104 | upX_ = x;
105 | upY_ = y;
106 | upZ_ = z;
107 | dirty_ = YES;
108 | }
109 |
110 | -(void) eyeX: (float*)x eyeY:(float*)y eyeZ:(float*)z
111 | {
112 | *x = eyeX_ / CC_CONTENT_SCALE_FACTOR();
113 | *y = eyeY_ / CC_CONTENT_SCALE_FACTOR();
114 | *z = eyeZ_ / CC_CONTENT_SCALE_FACTOR();
115 | }
116 |
117 | -(void) centerX: (float*)x centerY:(float*)y centerZ:(float*)z
118 | {
119 | *x = centerX_ / CC_CONTENT_SCALE_FACTOR();
120 | *y = centerY_ / CC_CONTENT_SCALE_FACTOR();
121 | *z = centerZ_ / CC_CONTENT_SCALE_FACTOR();
122 | }
123 |
124 | -(void) upX: (float*)x upY:(float*)y upZ:(float*)z
125 | {
126 | *x = upX_;
127 | *y = upY_;
128 | *z = upZ_;
129 | }
130 |
131 | @end
132 |
--------------------------------------------------------------------------------
/cocos2d-extensions/libs/cocos2d/Support/CCProfiling.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 | #import "../ccConfig.h"
27 |
28 | #if CC_ENABLE_PROFILERS
29 |
30 | #import "CCProfiling.h"
31 |
32 | @interface CCProfilingTimer()
33 | - (id)initWithName:(NSString*)timerName andInstance:(id)instance;
34 | @end
35 |
36 | @implementation CCProfiler
37 |
38 | static CCProfiler* g_sharedProfiler;
39 |
40 | + (CCProfiler*)sharedProfiler {
41 | if (!g_sharedProfiler)
42 | g_sharedProfiler = [[CCProfiler alloc] init];
43 |
44 | return g_sharedProfiler;
45 | }
46 |
47 | + (CCProfilingTimer*)timerWithName:(NSString*)timerName andInstance:(id)instance {
48 | CCProfiler* p = [CCProfiler sharedProfiler];
49 | CCProfilingTimer* t = [[CCProfilingTimer alloc] initWithName:timerName andInstance:instance];
50 | [p->activeTimers addObject:t];
51 | [t release];
52 | return t;
53 | }
54 |
55 | + (void)releaseTimer:(CCProfilingTimer*)timer {
56 | CCProfiler* p = [CCProfiler sharedProfiler];
57 | [p->activeTimers removeObject:timer];
58 | }
59 |
60 | - (id)init {
61 | if (!(self = [super init])) return nil;
62 |
63 | activeTimers = [[NSMutableArray alloc] init];
64 |
65 | return self;
66 | }
67 |
68 | - (void)dealloc {
69 | [activeTimers release];
70 | [super dealloc];
71 | }
72 |
73 | - (void)displayTimers {
74 | for (id timer in activeTimers) {
75 | printf("%s\n", [[timer description] cStringUsingEncoding:[NSString defaultCStringEncoding]]);
76 | }
77 | }
78 |
79 | @end
80 |
81 | @implementation CCProfilingTimer
82 |
83 | - (id)initWithName:(NSString*)timerName andInstance:(id)instance {
84 | if (!(self = [super init])) return nil;
85 |
86 | name = [[NSString stringWithFormat:@"%@ (0x%.8x)", timerName, instance] retain];
87 |
88 | return self;
89 | }
90 |
91 | - (void)dealloc {
92 | [name release];
93 | [super dealloc];
94 | }
95 |
96 | - (NSString*)description {
97 | return [NSString stringWithFormat:@"%@ : avg time, %fms", name, averageTime];
98 | }
99 |
100 | void CCProfilingBeginTimingBlock(CCProfilingTimer* timer) {
101 | gettimeofday(&timer->startTime, NULL);
102 | }
103 |
104 | typedef unsigned int uint32;
105 | void CCProfilingEndTimingBlock(CCProfilingTimer* timer) {
106 | struct timeval currentTime;
107 | gettimeofday(¤tTime, NULL);
108 | timersub(¤tTime, &timer->startTime, ¤tTime);
109 | double duration = currentTime.tv_sec * 1000.0 + currentTime.tv_usec / 1000.0;
110 |
111 | // return in milliseconds
112 | timer->averageTime = (timer->averageTime + duration) / 2.0f;
113 | }
114 |
115 | @end
116 |
117 | #endif
118 |
--------------------------------------------------------------------------------
/cocos2d-extensions/libs/cocos2d/Support/CCArray.h:
--------------------------------------------------------------------------------
1 | /*
2 | * cocos2d for iPhone: http://www.cocos2d-iphone.org
3 | *
4 | * Copyright (c) 2010 ForzeField Studios S.L. http://forzefield.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 "ccCArray.h"
27 |
28 |
29 | /** A faster alternative of NSArray.
30 | CCArray uses internally a c-array.
31 | @since v0.99.4
32 | */
33 |
34 |
35 | /** @def CCARRAY_FOREACH
36 | A convience macro to iterate over a CCArray using. It is faster than the "fast enumeration" interface.
37 | @since v0.99.4
38 | */
39 |
40 | #define CCARRAY_FOREACH(__array__, __object__) \
41 | if (__array__ && __array__->data->num > 0) \
42 | for(id *arr = __array__->data->arr, *end = __array__->data->arr + __array__->data->num-1; \
43 | arr <= end && ((__object__ = *arr) != nil || true); \
44 | arr++)
45 |
46 | @interface CCArray : NSObject
47 | {
48 | @public ccArray *data;
49 | }
50 |
51 | + (id) array;
52 | + (id) arrayWithCapacity:(NSUInteger)capacity;
53 | + (id) arrayWithArray:(CCArray*)otherArray;
54 | + (id) arrayWithNSArray:(NSArray*)otherArray;
55 |
56 |
57 | - (id) initWithCapacity:(NSUInteger)capacity;
58 | - (id) initWithArray:(CCArray*)otherArray;
59 | - (id) initWithNSArray:(NSArray*)otherArray;
60 |
61 |
62 | // Querying an Array
63 |
64 | - (NSUInteger) count;
65 | - (NSUInteger) capacity;
66 | - (NSUInteger) indexOfObject:(id)object;
67 | - (id) objectAtIndex:(NSUInteger)index;
68 | - (BOOL) containsObject:(id)object;
69 | - (id) randomObject;
70 | - (id) lastObject;
71 | - (NSArray*) getNSArray;
72 |
73 |
74 | // Adding Objects
75 |
76 | - (void) addObject:(id)object;
77 | - (void) addObjectsFromArray:(CCArray*)otherArray;
78 | - (void) addObjectsFromNSArray:(NSArray*)otherArray;
79 | - (void) insertObject:(id)object atIndex:(NSUInteger)index;
80 |
81 |
82 | // Removing Objects
83 |
84 | - (void) removeLastObject;
85 | - (void) removeObject:(id)object;
86 | - (void) removeObjectAtIndex:(NSUInteger)index;
87 | - (void) removeObjectsInArray:(CCArray*)otherArray;
88 | - (void) removeAllObjects;
89 | - (void) fastRemoveObject:(id)object;
90 | - (void) fastRemoveObjectAtIndex:(NSUInteger)index;
91 |
92 |
93 | // Rearranging Content
94 |
95 | - (void) exchangeObject:(id)object1 withObject:(id)object2;
96 | - (void) exchangeObjectAtIndex:(NSUInteger)index1 withObjectAtIndex:(NSUInteger)index2;
97 | - (void) reverseObjects;
98 | - (void) reduceMemoryFootprint;
99 |
100 | // Sending Messages to Elements
101 |
102 | - (void) makeObjectsPerformSelector:(SEL)aSelector;
103 | - (void) makeObjectsPerformSelector:(SEL)aSelector withObject:(id)object;
104 |
105 |
106 | @end
107 |
--------------------------------------------------------------------------------
/cocos2d-extensions/libs/cocos2d/Platforms/iOS/CCTouchHandler.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 | /*
32 | * This file contains the delegates of the touches
33 | * There are 2 possible delegates:
34 | * - CCStandardTouchHandler: propagates all the events at once
35 | * - CCTargetedTouchHandler: propagates 1 event at the time
36 | */
37 |
38 | #import "CCTouchDelegateProtocol.h"
39 | #import "CCTouchDispatcher.h"
40 |
41 | /**
42 | CCTouchHandler
43 | Object than contains the delegate and priority of the event handler.
44 | */
45 | @interface CCTouchHandler : NSObject {
46 | id delegate;
47 | int priority;
48 | ccTouchSelectorFlag enabledSelectors_;
49 | }
50 |
51 | /** delegate */
52 | @property(nonatomic, readwrite, retain) id delegate;
53 | /** priority */
54 | @property(nonatomic, readwrite) int priority; // default 0
55 | /** enabled selectors */
56 | @property(nonatomic,readwrite) ccTouchSelectorFlag enabledSelectors;
57 |
58 | /** allocates a TouchHandler with a delegate and a priority */
59 | + (id)handlerWithDelegate:(id)aDelegate priority:(int)priority;
60 | /** initializes a TouchHandler with a delegate and a priority */
61 | - (id)initWithDelegate:(id)aDelegate priority:(int)priority;
62 | @end
63 |
64 | /** CCStandardTouchHandler
65 | It forwardes each event to the delegate.
66 | */
67 | @interface CCStandardTouchHandler : CCTouchHandler
68 | {
69 | }
70 | @end
71 |
72 | /**
73 | CCTargetedTouchHandler
74 | Object than contains the claimed touches and if it swallos touches.
75 | Used internally by TouchDispatcher
76 | */
77 | @interface CCTargetedTouchHandler : CCTouchHandler {
78 | BOOL swallowsTouches;
79 | NSMutableSet *claimedTouches;
80 | }
81 | /** whether or not the touches are swallowed */
82 | @property(nonatomic, readwrite) BOOL swallowsTouches; // default NO
83 | /** MutableSet that contains the claimed touches */
84 | @property(nonatomic, readonly) NSMutableSet *claimedTouches;
85 |
86 | /** allocates a TargetedTouchHandler with a delegate, a priority and whether or not it swallows touches or not */
87 | + (id)handlerWithDelegate:(id) aDelegate priority:(int)priority swallowsTouches:(BOOL)swallowsTouches;
88 | /** initializes a TargetedTouchHandler with a delegate, a priority and whether or not it swallows touches or not */
89 | - (id)initWithDelegate:(id) aDelegate priority:(int)priority swallowsTouches:(BOOL)swallowsTouches;
90 |
91 | @end
92 |
93 | #endif // __IPHONE_OS_VERSION_MAX_ALLOWED
94 |
--------------------------------------------------------------------------------
/cocos2d-extensions/libs/cocos2d/CCMotionStreak.m:
--------------------------------------------------------------------------------
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 | *
27 | * Motion Streak manages a Ribbon based on it's motion in absolute space.
28 | * You construct it with a fadeTime, minimum segment size, texture path, texture
29 | * length and color. The fadeTime controls how long it takes each vertex in
30 | * the streak to fade out, the minimum segment size it how many pixels the
31 | * streak will move before adding a new ribbon segement, and the texture
32 | * length is the how many pixels the texture is stretched across. The texture
33 | * is vertically aligned along the streak segemnts.
34 | */
35 |
36 | #import "CCMotionStreak.h"
37 | #import "Support/CGPointExtension.h"
38 |
39 | @implementation CCMotionStreak
40 |
41 | @synthesize ribbon = ribbon_;
42 |
43 | +(id)streakWithFade:(float)fade minSeg:(float)seg image:(NSString*)path width:(float)width length:(float)length color:(ccColor4B)color
44 | {
45 | return [[[self alloc] initWithFade:(float)fade minSeg:seg image:path width:width length:length color:color] autorelease];
46 | }
47 |
48 | -(id)initWithFade:(float)fade minSeg:(float)seg image:(NSString*)path width:(float)width length:(float)length color:(ccColor4B)color
49 | {
50 | if( (self=[super init])) {
51 | segThreshold_ = seg;
52 | width_ = width;
53 | lastLocation_ = CGPointZero;
54 | ribbon_ = [CCRibbon ribbonWithWidth:width_ image:path length:length color:color fade:fade];
55 | [self addChild:ribbon_];
56 |
57 | // update ribbon position. Use schedule:interval and not scheduleUpdated. issue #1075
58 | [self schedule:@selector(update:) interval:0];
59 | }
60 | return self;
61 | }
62 |
63 | -(void)update:(ccTime)delta
64 | {
65 | CGPoint location = [self convertToWorldSpace:CGPointZero];
66 | [ribbon_ setPosition:ccp(-1*location.x, -1*location.y)];
67 | float len = ccpLength(ccpSub(lastLocation_, location));
68 | if (len > segThreshold_)
69 | {
70 | [ribbon_ addPointAt:location width:width_];
71 | lastLocation_ = location;
72 | }
73 | [ribbon_ update:delta];
74 | }
75 |
76 |
77 | -(void)dealloc
78 | {
79 | [super dealloc];
80 | }
81 |
82 | #pragma mark MotionStreak - CocosNodeTexture protocol
83 |
84 | -(void) setTexture:(CCTexture2D*) texture
85 | {
86 | [ribbon_ setTexture: texture];
87 | }
88 |
89 | -(CCTexture2D*) texture
90 | {
91 | return [ribbon_ texture];
92 | }
93 |
94 | -(ccBlendFunc) blendFunc
95 | {
96 | return [ribbon_ blendFunc];
97 | }
98 |
99 | -(void) setBlendFunc:(ccBlendFunc)blendFunc
100 | {
101 | [ribbon_ setBlendFunc:blendFunc];
102 | }
103 |
104 | @end
105 |
--------------------------------------------------------------------------------