├── example ├── CCSVGExample │ ├── en.lproj │ │ ├── InfoPlist.strings │ │ ├── bird_0001.svg │ │ └── bird_0002.svg │ ├── Classes │ │ ├── AppDelegate.h │ │ └── AppDelegate.mm │ ├── CCSVGExample-Prefix.pch │ ├── main.m │ └── CCSVGExample-Info.plist └── CCSVGExample.xcodeproj │ ├── project.xcworkspace │ └── contents.xcworkspacedata │ ├── xcshareddata │ └── xcschemes │ │ └── CCSVGExample.xcscheme │ └── project.pbxproj ├── src ├── CCSVG.h ├── CCSVGSprite.h ├── CCSVGSource.h ├── CCSVGCache.h ├── CCSVGAnimationCache.h ├── CCSVGAnimate.h ├── CCSVGAnimation.h ├── CCSVGSource.mm ├── CCSVGCache.mm ├── CCSVGSprite.mm ├── CCSVGAnimate.mm ├── CCSVGAnimation.mm └── CCSVGAnimationCache.mm ├── CCSVG.xcodeproj ├── project.xcworkspace │ └── contents.xcworkspacedata ├── xcshareddata │ └── xcschemes │ │ └── CCSVG.xcscheme └── project.pbxproj ├── .gitmodules ├── CCSVG.xcworkspace └── contents.xcworkspacedata ├── LICENCE └── README.md /example/CCSVGExample/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /src/CCSVG.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import 3 | #import 4 | #import 5 | #import 6 | #import 7 | -------------------------------------------------------------------------------- /CCSVG.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /example/CCSVGExample.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /example/CCSVGExample/Classes/AppDelegate.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | 4 | @interface AppDelegate : UIResponder 5 | 6 | 7 | #pragma mark 8 | 9 | @property (strong, nonatomic) UINavigationController *navigationController; 10 | 11 | @property (strong, nonatomic) UIWindow *window; 12 | 13 | 14 | @end 15 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "external/cocos2d-iphone"] 2 | path = external/cocos2d-iphone 3 | url = git://github.com/cocos2d/cocos2d-iphone.git 4 | [submodule "external/MonkVG"] 5 | path = external/MonkVG 6 | url = git@github.com:lukelutman/MonkVG.git 7 | [submodule "external/MonkSVG"] 8 | path = external/MonkSVG 9 | url = git@github.com:lukelutman/MonkSVG.git 10 | -------------------------------------------------------------------------------- /example/CCSVGExample/CCSVGExample-Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header for all source files of the 'CCSVGExample' target in the 'CCSVGExample' project 3 | // 4 | 5 | #import 6 | 7 | #ifndef __IPHONE_4_0 8 | #warning "This project uses features only available in iOS SDK 4.0 and later." 9 | #endif 10 | 11 | #ifdef __OBJC__ 12 | #import 13 | #import 14 | #endif 15 | -------------------------------------------------------------------------------- /example/CCSVGExample/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // CCSVGExample 4 | // 5 | // Created by Luke Lutman on 12-05-28. 6 | // Copyright (c) 2012 __MyCompanyName__. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | #import "AppDelegate.h" 12 | 13 | int main(int argc, char *argv[]) 14 | { 15 | @autoreleasepool { 16 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/CCSVGSprite.h: -------------------------------------------------------------------------------- 1 | #import "cocos2d.h" 2 | 3 | 4 | @class CCSVGSource; 5 | 6 | 7 | @interface CCSVGSprite : CCNode 8 | 9 | 10 | #pragma mark 11 | 12 | @property (readwrite, retain) CCSVGSource *source; 13 | 14 | 15 | #pragma mark 16 | 17 | + (id)spriteWithFile:(NSString *)file; 18 | 19 | + (id)spriteWithSource:(CCSVGSource *)source; 20 | 21 | - (id)initWithFile:(NSString *)file; 22 | 23 | - (id)initWithSource:(CCSVGSource *)source; 24 | 25 | 26 | @end 27 | -------------------------------------------------------------------------------- /src/CCSVGSource.h: -------------------------------------------------------------------------------- 1 | #import "cocos2d.h" 2 | 3 | 4 | @interface CCSVGSource : NSObject 5 | 6 | 7 | #pragma mark 8 | 9 | + (void)setTessellationIterations:(NSUInteger)numberOfTesselationIterations; 10 | 11 | 12 | #pragma mark 13 | 14 | @property (readwrite, assign) CGRect contentRect; 15 | 16 | @property (readwrite, assign) CGSize contentSize; 17 | 18 | @property (readonly, assign) BOOL hasTransparentColors; 19 | 20 | 21 | #pragma mark 22 | 23 | - (id)initWithData:(NSData *)data; 24 | 25 | - (id)initWithFile:(NSString *)name; 26 | 27 | 28 | #pragma mark 29 | 30 | - (void)draw; 31 | 32 | - (void)optimize; 33 | 34 | 35 | @end 36 | -------------------------------------------------------------------------------- /CCSVG.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 12 | 13 | 15 | 16 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /src/CCSVGCache.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | 4 | @class CCSVGSource; 5 | 6 | 7 | @interface CCSVGCache : NSObject 8 | 9 | 10 | #pragma mark 11 | 12 | + (CCSVGCache *)sharedSVGCache; 13 | 14 | + (void)purgeSharedSVGCache; 15 | 16 | 17 | #pragma mark 18 | 19 | - (CCSVGSource *)addData:(NSData *)data forKey:(NSString *)key; 20 | 21 | - (CCSVGSource *)addFile:(NSString *)name; 22 | 23 | - (CCSVGSource *)addSource:(CCSVGSource *)source forKey:(NSString *)key; 24 | 25 | 26 | #pragma mark 27 | 28 | - (CCSVGSource *)sourceForKey:(NSString *)key; 29 | 30 | 31 | #pragma mark 32 | 33 | - (void)removeAllSources; 34 | 35 | - (void)removeUnusedSources; 36 | 37 | - (void)removeSource:(CCSVGSource *)data; 38 | 39 | - (void)removeSourceForKey:(NSString *)key; 40 | 41 | 42 | @end -------------------------------------------------------------------------------- /src/CCSVGAnimationCache.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | 4 | @class CCSVGAnimation; 5 | 6 | 7 | @interface CCSVGAnimationCache : NSObject 8 | 9 | 10 | #pragma mark 11 | 12 | + (CCSVGAnimationCache *)sharedAnimationCache; 13 | 14 | + (void)purgeSharedAnimationCache; 15 | 16 | 17 | #pragma mark 18 | 19 | - (void)addAnimation:(CCSVGAnimation *)animation name:(NSString *)name; 20 | 21 | - (void)addAnimationsWithDictionary:(NSDictionary *)dictionary; 22 | 23 | - (void)addAnimationsWithFile:(NSString *)plist; 24 | 25 | 26 | #pragma mark 27 | 28 | - (CCSVGAnimation *)animationByName:(NSString *)name; 29 | 30 | 31 | #pragma mark 32 | 33 | - (void)removeAnimationByName:(NSString *)name; 34 | 35 | - (void)removeAllAnimations; 36 | 37 | - (void)removeUnusedAnimations; 38 | 39 | 40 | @end 41 | -------------------------------------------------------------------------------- /LICENCE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2012 Luke Lutman 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 4 | 5 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 6 | 7 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------- /src/CCSVGAnimate.h: -------------------------------------------------------------------------------- 1 | #import "CCActionInterval.h" 2 | 3 | 4 | @class CCSVGAnimation; 5 | 6 | 7 | @interface CCSVGAnimate : CCActionInterval { 8 | NSMutableArray *splitTimes_; 9 | NSInteger nextFrame_; 10 | CCSVGAnimation *animation_; 11 | id origFrame_; 12 | BOOL restoreOriginalFrame_; 13 | } 14 | 15 | 16 | #pragma mark 17 | 18 | @property (nonatomic, readwrite, retain) CCSVGAnimation *animation; 19 | 20 | 21 | #pragma mark 22 | 23 | + (id)actionWithSVGAnimation:(CCSVGAnimation *)animation; 24 | 25 | - (id)initWithSVGAnimation:(CCSVGAnimation *)animation; 26 | 27 | 28 | + (id)actionWithSVGAnimation:(CCSVGAnimation *)animation restoreOriginalFrame:(BOOL)restoreOriginalFrame; 29 | 30 | - (id)initWithSVGAnimation:(CCSVGAnimation *)animation restoreOriginalFrame:(BOOL)restoreOriginalFrame; 31 | 32 | 33 | + (id)actionWithSVGAnimation:(CCSVGAnimation *)animation restoreOriginalFrame:(BOOL)restoreOriginalFrame duration:(ccTime)duration; 34 | 35 | - (id)initWithSVGAnimation:(CCSVGAnimation *)animation restoreOriginalFrame:(BOOL)restoreOriginalFrame duration:(ccTime)duration; 36 | 37 | 38 | @end -------------------------------------------------------------------------------- /example/CCSVGExample/CCSVGExample-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | ${PRODUCT_NAME} 9 | CFBundleExecutable 10 | ${EXECUTABLE_NAME} 11 | CFBundleIdentifier 12 | com.zincroe.com.labs.${PRODUCT_NAME:rfc1034identifier} 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | ${PRODUCT_NAME} 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1.0 25 | LSRequiresIPhoneOS 26 | 27 | UIRequiredDeviceCapabilities 28 | 29 | armv7 30 | 31 | UISupportedInterfaceOrientations 32 | 33 | UIInterfaceOrientationPortrait 34 | UIInterfaceOrientationLandscapeLeft 35 | UIInterfaceOrientationLandscapeRight 36 | 37 | UISupportedInterfaceOrientations~ipad 38 | 39 | UIInterfaceOrientationPortrait 40 | UIInterfaceOrientationPortraitUpsideDown 41 | UIInterfaceOrientationLandscapeLeft 42 | UIInterfaceOrientationLandscapeRight 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /src/CCSVGAnimation.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import 3 | 4 | 5 | @class CCSVGSource; 6 | 7 | 8 | @interface CCSVGAnimationFrame : NSObject 9 | 10 | 11 | #pragma mark 12 | 13 | @property (nonatomic, readwrite, assign) float delayUnits; 14 | 15 | @property (nonatomic, readwrite, retain) CCSVGSource *source; 16 | 17 | @property (nonatomic, readwrite, retain) NSDictionary *userInfo; 18 | 19 | 20 | #pragma mark 21 | 22 | - (id)initWithSource:(CCSVGSource *)source delayUnits:(float)delayUnits userInfo:(NSDictionary *)userInfo; 23 | 24 | 25 | @end 26 | 27 | 28 | 29 | #pragma mark 30 | 31 | @interface CCSVGAnimation : NSObject 32 | 33 | 34 | #pragma mark 35 | 36 | @property (nonatomic, readonly, assign) CGRect contentRect; 37 | 38 | @property (nonatomic, readonly, assign) CGSize contentSize; 39 | 40 | @property (nonatomic, readwrite, assign) float delayPerUnit; 41 | 42 | @property (nonatomic, readwrite, assign) float duration; 43 | 44 | @property (nonatomic, readwrite, retain) NSMutableArray *frames; 45 | 46 | @property (nonatomic, readwrite, assign) BOOL restoreOriginalFrame; 47 | 48 | @property (nonatomic, readwrite, assign) float totalDelayUnits; 49 | 50 | 51 | #pragma mark 52 | 53 | + (id)animation; 54 | 55 | + (id)animationWithFrames:(NSArray *)frames delayPerUnit:(float)delayPerUnit; 56 | 57 | + (id)animationWithSources:(NSArray *)sources; 58 | 59 | + (id)animationWithSources:(NSArray *)sources delay:(float)delay; 60 | 61 | + (id)animationWithSourcesNamed:(NSString *)format count:(NSUInteger)count delay:(float)delay; 62 | 63 | 64 | # pragma mark 65 | 66 | - (id)initWithFrames:(NSArray *)frames delayPerUnit:(float)delayPerUnit; 67 | 68 | - (id)initWithSources:(NSArray *)sources; 69 | 70 | - (id)initWithSources:(NSArray *)sources delay:(float)delay; 71 | 72 | 73 | #pragma mark 74 | 75 | - (void)addFrameWithSource:(CCSVGSource *)source; 76 | 77 | - (void)addFrameWithSource:(CCSVGSource *)source delay:(float) delay; 78 | 79 | - (void)addFrameWithSourceNamed:(NSString *)name; 80 | 81 | 82 | #pragma mark 83 | 84 | - (void)optimize; 85 | 86 | 87 | @end 88 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | CCSVG - Display SVG images on iOS using Cocos2D 2 | =============================================== 3 | 4 | 5 | ## Overview 6 | 7 | CCSVG provides an API for loading, displaying and animating SVG images on iOS using Cocos2D. 8 | 9 | 10 | // load an svg image 11 | CCSVGSource *source; 12 | source = [CCSVGSource sourceWithFile:@"player_idle.svg"]; 13 | 14 | // display an svg image 15 | CCSVGSprite *sprite; 16 | sprite = [CCSVGSprite spriteWithSource:source]; 17 | sprite.position = ccp(240,160); 18 | 19 | // create an svg animation 20 | CCSVGAnimation *animation; 21 | animation = [CCSVGAnimation animationWithSourcesNamed:@"player_walk_%04d.svg" 22 | count:2 23 | delay:1.0/15.0]; 24 | 25 | // run the animation on the sprite 26 | CCSVGAnimate *animate; 27 | animate = [CCSVGAnimate actionWithSVGAnimation:animation]; 28 | [sprite runAction:[CCRepeatForever actionWithAction:animate]]; 29 | 30 | 31 | ## Benefits 32 | 33 | SVG images are displayed as vector data, not textures. Each file is tesselated and cached in a vertex buffer object, so the peformance penalty of tesselating and uploading the geometry to OpenGL only happens once when the file is first loaded. 34 | 35 | * Resolution-independence. 36 | * Smaller file size. 37 | * Smaller memory footprint. 38 | * Faster load times. 39 | 40 | 41 | ## Drawbacks 42 | 43 | There is a significant performance penalty for using images with transparent fills or strokes (drawing them properly means turning on blending in OpenGL). Avoid them where possible. 44 | 45 | * Incomplete SVG support (see [what is implemented](https://github.com/micahpearlman/MonkVG/blob/master/README.md#what-is-implemented) in MonkVG). 46 | * Antialiasing requires multisampling to be enabled, which has a performance penalty. 47 | 48 | 49 | ## Installation 50 | 51 | git clone git@github.com:lukelutman/CCSVG.git 52 | git submodule init 53 | git submodule update 54 | 55 | 56 | ## Dependencies 57 | 58 | * [cocos2d-iphone v1.1.0-beta2b](https://github.com/cocos2d/cocos2d-iphone) 59 | * [MonkVG](https://github.com/lukelutman/MonkVG) by [Micah Pearlman](https://github.com/micahpearlman) 60 | * [MonkSVG](https://github.com/lukelutman/MonkSVG) by [Micah Pearlman](https://github.com/micahpearlman) 61 | 62 | ## Resources 63 | 64 | * [flash2svg Extension](http://www.adobe.com/cfusion/exchange/index.cfm?event=extensionDetail&loc=en_us&extid=2422028) for exporting SVG images from Flash -------------------------------------------------------------------------------- /src/CCSVGSource.mm: -------------------------------------------------------------------------------- 1 | // 2 | // CCSVGSource.m 3 | // CCSVG 4 | // 5 | // Created by Luke Lutman on 12-05-22. 6 | // Copyright (c) 2012 Zinc Roe Design. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | #import 12 | #import "CCSVGSource.h" 13 | 14 | 15 | @interface CCSVGSource () 16 | 17 | @property (nonatomic, readwrite, assign) BOOL isOptimized; 18 | 19 | @property (nonatomic, readwrite, assign) MonkSVG::OpenVG_SVGHandler::SmartPtr svg; 20 | 21 | @end 22 | 23 | 24 | @implementation CCSVGSource 25 | 26 | 27 | #pragma mark 28 | 29 | + (void)initialize { 30 | [self setTessellationIterations:3]; 31 | } 32 | 33 | + (void)setTessellationIterations:(NSUInteger)numberOfTesselationIterations { 34 | vgSeti(VG_TESSELLATION_ITERATIONS_MNK, numberOfTesselationIterations); 35 | } 36 | 37 | 38 | #pragma mark 39 | 40 | @synthesize contentRect = contentRect_; 41 | 42 | @synthesize contentSize = contentSize_; 43 | 44 | @synthesize isOptimized = isOptimized_; 45 | 46 | @synthesize svg = svg_; 47 | 48 | - (BOOL)hasTransparentColors { 49 | return svg_->hasTransparentColors(); 50 | } 51 | 52 | 53 | #pragma mark 54 | 55 | - (id)init { 56 | if ((self = [super init])) { 57 | isOptimized_ = NO; 58 | svg_ = boost::static_pointer_cast(MonkSVG::OpenVG_SVGHandler::create()); 59 | } 60 | return self; 61 | } 62 | 63 | - (id)initWithData:(NSData *)data { 64 | if ((self = [self init])) { 65 | 66 | MonkSVG::SVG parser; 67 | parser.initialize(svg_); 68 | parser.read((char *)data.bytes); 69 | 70 | contentRect_ = CGRectMake(svg_->minX(), svg_->minY(), svg_->width(), svg_->height()); 71 | contentSize_ = CGSizeMake(svg_->width(), svg_->height()); 72 | 73 | } 74 | return self; 75 | } 76 | 77 | - (id)initWithFile:(NSString *)name { 78 | 79 | NSString *path; 80 | path = [[NSBundle mainBundle] pathForResource:name ofType:nil]; 81 | NSAssert1(path, @"Missing SVG file: %@", name); 82 | 83 | NSData *data; 84 | data = [NSData dataWithContentsOfFile:path]; 85 | NSAssert1(data, @"Invalid SVG file: %@", name); 86 | 87 | return [self initWithData:data]; 88 | 89 | } 90 | 91 | - (void)dealloc { 92 | [super dealloc]; 93 | } 94 | 95 | 96 | #pragma mark 97 | 98 | - (void)draw { 99 | 100 | [self optimize]; 101 | 102 | svg_->draw(); 103 | 104 | } 105 | 106 | - (void)optimize { 107 | 108 | if (!isOptimized_) { 109 | 110 | VGfloat matrix[9]; 111 | vgGetMatrix(matrix); 112 | 113 | vgLoadIdentity(); 114 | svg_->optimize(); 115 | vgLoadMatrix(matrix); 116 | 117 | isOptimized_ = YES; 118 | 119 | } 120 | 121 | } 122 | 123 | 124 | @end 125 | -------------------------------------------------------------------------------- /example/CCSVGExample/Classes/AppDelegate.mm: -------------------------------------------------------------------------------- 1 | #import "AppDelegate.h" 2 | #import "cocos2d.h" 3 | #import 4 | 5 | 6 | @implementation AppDelegate 7 | 8 | 9 | #pragma mark 10 | 11 | @synthesize navigationController = navigationController_; 12 | 13 | @synthesize window = window_; 14 | 15 | 16 | #pragma mark 17 | 18 | - (void)dealloc { 19 | [navigationController_ release]; 20 | [window_ release]; 21 | [super dealloc]; 22 | } 23 | 24 | 25 | #pragma mark 26 | 27 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 28 | 29 | EAGLView *openGLView; 30 | openGLView = [[[EAGLView alloc] initWithFrame:[UIScreen mainScreen].bounds 31 | pixelFormat:kEAGLColorFormatRGBA8 32 | depthFormat:0 33 | preserveBackbuffer:NO 34 | sharegroup:nil 35 | multiSampling:YES 36 | numberOfSamples:1] autorelease]; 37 | [openGLView setMultipleTouchEnabled:YES]; 38 | 39 | UIViewController *viewController; 40 | viewController = [[[UIViewController alloc] init] autorelease]; 41 | viewController.view = openGLView; 42 | 43 | UINavigationController *navigationController; 44 | navigationController = [[[UINavigationController alloc] initWithRootViewController:viewController] autorelease]; 45 | navigationController.navigationBarHidden = YES; 46 | [self setNavigationController:navigationController]; 47 | 48 | UIWindow *window; 49 | window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease]; 50 | [window setRootViewController:navigationController]; 51 | [window makeKeyAndVisible]; 52 | [self setWindow:window]; 53 | 54 | [CCDirector setDirectorType:kCCDirectorTypeDisplayLink]; 55 | [CCTexture2D setDefaultAlphaPixelFormat:kCCTexture2DPixelFormat_RGBA8888]; 56 | 57 | [[CCDirector sharedDirector] setAnimationInterval:1.0/60.0]; 58 | [[CCDirector sharedDirector] setDisplayFPS:YES]; 59 | [[CCDirector sharedDirector] setDeviceOrientation:CCDeviceOrientationPortrait]; 60 | [[CCDirector sharedDirector] setOpenGLView:openGLView]; 61 | [[CCDirector sharedDirector] enableRetinaDisplay:YES]; 62 | [[CCDirector sharedDirector] setProjection:CCDirectorProjection2D]; 63 | 64 | CCScene *scene; 65 | scene = [CCScene node]; 66 | [[CCDirector sharedDirector] runWithScene:scene]; 67 | 68 | CCSVGSprite *sprite; 69 | sprite = [CCSVGSprite spriteWithFile:@"bird_0001.svg"]; 70 | sprite.position = ccpMult(ccpFromSize([CCDirector sharedDirector].winSize), 0.5); 71 | [scene addChild:sprite]; 72 | 73 | CCSVGAnimation *animation; 74 | animation = [CCSVGAnimation animationWithSourcesNamed:@"bird_%04d.svg" count:2 delay:1.0/15.0]; 75 | [sprite runAction:[CCRepeatForever actionWithAction:[CCSVGAnimate actionWithSVGAnimation:animation]]]; 76 | 77 | return YES; 78 | 79 | } 80 | 81 | 82 | @end 83 | -------------------------------------------------------------------------------- /src/CCSVGCache.mm: -------------------------------------------------------------------------------- 1 | #import "CCSVGSource.h" 2 | #import "CCSVGCache.h" 3 | 4 | 5 | @interface CCSVGCache () 6 | 7 | 8 | #pragma mark 9 | 10 | @property (readwrite, retain) NSMutableDictionary *sources; 11 | 12 | 13 | @end 14 | 15 | 16 | #pragma mark 17 | 18 | @implementation CCSVGCache 19 | 20 | 21 | static CCSVGCache *sharedSVGCache; 22 | 23 | 24 | #pragma mark 25 | 26 | + (id)alloc { 27 | NSAssert(sharedSVGCache == nil, @"Attempted to allocate a second instance of a singleton."); 28 | return [super alloc]; 29 | } 30 | 31 | + (CCSVGCache *)sharedSVGCache { 32 | if (!sharedSVGCache) { 33 | sharedSVGCache = [[CCSVGCache alloc] init]; 34 | } 35 | return sharedSVGCache; 36 | } 37 | 38 | + (void)purgeSharedSVGCache { 39 | [sharedSVGCache release]; 40 | sharedSVGCache = nil; 41 | } 42 | 43 | 44 | #pragma mark 45 | 46 | @synthesize sources = sources_; 47 | 48 | 49 | #pragma mark 50 | 51 | - (id)init { 52 | if ((self = [super init])) { 53 | self.sources = [NSMutableDictionary dictionary]; 54 | } 55 | return self; 56 | } 57 | 58 | - (void)dealloc { 59 | [sources_ release]; 60 | [super dealloc]; 61 | } 62 | 63 | 64 | #pragma mark 65 | 66 | - (CCSVGSource *)addData:(NSData *)data forKey:(NSString *)key { 67 | 68 | NSAssert(data != nil, @"Invalid data"); 69 | NSAssert(key != nil, @"Invalid key"); 70 | 71 | CCSVGSource *source = [self sourceForKey:key]; 72 | if (source == nil) { 73 | source = [[[CCSVGSource alloc] initWithData:data] autorelease]; 74 | NSAssert(source != nil, @"Could not create source from data"); 75 | [self.sources setObject:source forKey:key]; 76 | } 77 | return source; 78 | 79 | } 80 | 81 | - (CCSVGSource *)addFile:(NSString *)name { 82 | 83 | NSAssert(name != nil, @"invalid file"); 84 | 85 | CCSVGSource *source = [self sourceForKey:name]; 86 | if (source == nil) { 87 | source = [[[CCSVGSource alloc] initWithFile:name] autorelease]; 88 | NSAssert1(source != nil, @"could not create source from file: %@", name); 89 | [self.sources setObject:source forKey:name]; 90 | } 91 | return source; 92 | 93 | } 94 | 95 | - (CCSVGSource *)addSource:(CCSVGSource *)source forKey:(NSString *)key { 96 | 97 | NSAssert(source != nil, @"source cannot be nil"); 98 | NSAssert(key != nil, @"key cannot be nil"); 99 | NSAssert([self sourceForKey:key] == source, @"duplicate key"); 100 | 101 | [self.sources setObject:source forKey:key]; 102 | return source; 103 | 104 | } 105 | 106 | 107 | #pragma mark 108 | 109 | - (CCSVGSource *)sourceForKey:(NSString *)key { 110 | return [self.sources objectForKey:key]; 111 | } 112 | 113 | 114 | #pragma mark 115 | 116 | - (void)removeAllSources { 117 | [self.sources removeAllObjects]; 118 | } 119 | 120 | - (void)removeUnusedSources { 121 | NSArray *keys = [self.sources allKeys]; 122 | for (NSString *key in keys) { 123 | CCSVGSource *source = [self sourceForKey:key]; 124 | if ([source retainCount] == 1) { 125 | CCLOG(@"cocos2d: CCSVGCache: removing unused source: %@", key); 126 | [self removeSourceForKey:key]; 127 | } 128 | } 129 | } 130 | 131 | - (void)removeSource:(CCSVGSource *)source { 132 | [self.sources removeObjectsForKeys:[self.sources allKeysForObject:source]]; 133 | } 134 | 135 | - (void)removeSourceForKey:(NSString *)key { 136 | [self.sources removeObjectForKey:key]; 137 | } 138 | 139 | 140 | @end 141 | -------------------------------------------------------------------------------- /example/CCSVGExample.xcodeproj/xcshareddata/xcschemes/CCSVGExample.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 4 | 7 | 8 | 14 | 20 | 21 | 22 | 23 | 24 | 29 | 30 | 31 | 32 | 38 | 39 | 40 | 41 | 51 | 52 | 58 | 59 | 60 | 61 | 62 | 63 | 69 | 70 | 76 | 77 | 78 | 79 | 81 | 82 | 85 | 86 | 87 | -------------------------------------------------------------------------------- /CCSVG.xcodeproj/xcshareddata/xcschemes/CCSVG.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 4 | 7 | 8 | 14 | 20 | 21 | 22 | 28 | 34 | 35 | 36 | 42 | 48 | 49 | 50 | 51 | 52 | 57 | 58 | 59 | 60 | 69 | 70 | 71 | 72 | 78 | 79 | 81 | 82 | 85 | 86 | 87 | -------------------------------------------------------------------------------- /src/CCSVGSprite.mm: -------------------------------------------------------------------------------- 1 | #import "CCSVGCache.h" 2 | #import "CCSVGSprite.h" 3 | #import "CCSVGSource.h" 4 | 5 | #include 6 | #include 7 | #include 8 | #include 9 | 10 | 11 | 12 | #pragma mark 13 | 14 | @implementation CCSVGSprite { 15 | ccBlendFunc blendFunc_; 16 | } 17 | 18 | 19 | #pragma mark 20 | 21 | @synthesize source = source_; 22 | 23 | 24 | #pragma mark 25 | 26 | + (id)spriteWithFile:(NSString *)name { 27 | return [[[self alloc] initWithFile:name] autorelease]; 28 | } 29 | 30 | + (id)spriteWithSource:(CCSVGSource *)source { 31 | return [[[self alloc] initWithSource:source] autorelease]; 32 | } 33 | 34 | - (id)initWithFile:(NSString *)name { 35 | return [self initWithSource:[[CCSVGCache sharedSVGCache] addFile:name]]; 36 | } 37 | 38 | - (id)initWithSource:(CCSVGSource *)source { 39 | if ((self = [super init])) { 40 | self.anchorPoint = ccp(-source.contentRect.origin.x / source.contentRect.size.width, 41 | -source.contentRect.origin.y / source.contentRect.size.height); 42 | self.blendFunc = (ccBlendFunc){ GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA }; 43 | self.contentSize = source.contentSize; 44 | self.source = source; 45 | } 46 | return self; 47 | } 48 | 49 | - (void)dealloc { 50 | [source_ release]; 51 | [super dealloc]; 52 | } 53 | 54 | 55 | #pragma mark 56 | 57 | - (void)draw { 58 | 59 | // skip drawing if the sprite has no source 60 | if (!self.source) { 61 | return; 62 | } 63 | 64 | // disable default states 65 | CC_DISABLE_DEFAULT_GL_STATES(); 66 | 67 | // handle blending 68 | BOOL doBlend; 69 | doBlend = self.source.hasTransparentColors; 70 | 71 | BOOL doBlendFunc; 72 | doBlendFunc = (blendFunc_.src != CC_BLEND_SRC || blendFunc_.dst != CC_BLEND_DST); 73 | 74 | if (!doBlend) { 75 | glDisable(GL_BLEND); 76 | } else if (doBlendFunc) { 77 | glBlendFunc(blendFunc_.src, blendFunc_.dst); 78 | } 79 | 80 | // transform 81 | CGAffineTransform transform; 82 | transform = CGAffineTransformIdentity; 83 | transform = CGAffineTransformConcat(transform, CGAffineTransformMakeScale(1.0f, -1.0f)); 84 | transform = CGAffineTransformConcat(transform, CGAffineTransformMakeTranslation(0.0f, self.contentSize.height)); 85 | transform = CGAffineTransformConcat(transform, CGAffineTransformMakeScale(CC_CONTENT_SCALE_FACTOR(), CC_CONTENT_SCALE_FACTOR())); 86 | transform = CGAffineTransformConcat(transform, self.nodeToWorldTransform); 87 | 88 | // matrix 89 | VGfloat matrix[9] = { 90 | transform.a, transform.c, transform.tx, // a, c, tx 91 | transform.b, transform.d, transform.ty, // b, d, ty 92 | 0, 0, 1, // 0, 0, 1 93 | }; 94 | vgLoadMatrix(matrix); 95 | 96 | // draw 97 | [self.source draw]; 98 | 99 | // clear the transform used for drawing the swf 100 | glLoadIdentity(); 101 | 102 | // apply the transform used for drawing children 103 | [self transformAncestors]; 104 | 105 | // enable blending 106 | if (!doBlend) { 107 | glEnable(GL_BLEND); 108 | } else if (doBlendFunc) { 109 | glBlendFunc(CC_BLEND_SRC, CC_BLEND_DST); 110 | } 111 | 112 | // enable default states 113 | CC_ENABLE_DEFAULT_GL_STATES(); 114 | 115 | } 116 | 117 | 118 | #pragma mark - CCBlendProtocol 119 | 120 | - (ccBlendFunc)blendFunc { 121 | return blendFunc_; 122 | } 123 | 124 | - (void)setBlendFunc:(ccBlendFunc)blendFunc { 125 | blendFunc_ = blendFunc; 126 | } 127 | 128 | 129 | @end 130 | -------------------------------------------------------------------------------- /src/CCSVGAnimate.mm: -------------------------------------------------------------------------------- 1 | #import "CCSVGAnimate.h" 2 | #import "CCSVGAnimation.h" 3 | #import "CCSVGSprite.h" 4 | #import "CCSVGSource.h" 5 | 6 | 7 | @implementation CCSVGAnimate 8 | 9 | 10 | #pragma mark 11 | 12 | @synthesize animation = animation_; 13 | 14 | 15 | #pragma mark 16 | 17 | + (id)actionWithSVGAnimation:(CCSVGAnimation *)animation { 18 | return [[[self alloc] initWithSVGAnimation:animation restoreOriginalFrame:animation.restoreOriginalFrame] autorelease]; 19 | } 20 | 21 | + (id)actionWithSVGAnimation:(CCSVGAnimation *)animation restoreOriginalFrame:(BOOL)restoreOriginalFrame { 22 | return [[[self alloc] initWithSVGAnimation:animation restoreOriginalFrame:restoreOriginalFrame] autorelease]; 23 | } 24 | 25 | + (id)actionWithSVGAnimation:(CCSVGAnimation *)animation restoreOriginalFrame:(BOOL)restoreOriginalFrame duration:(ccTime)duration { 26 | return [[[self alloc] initWithSVGAnimation:animation restoreOriginalFrame:restoreOriginalFrame duration:duration] autorelease]; 27 | } 28 | 29 | - (id)initWithSVGAnimation:(CCSVGAnimation *)animation { 30 | NSAssert(animation != nil, @"Animate: argument Animation must be non-nil"); 31 | return [self initWithSVGAnimation:animation restoreOriginalFrame:animation.restoreOriginalFrame]; 32 | } 33 | 34 | - (id)initWithSVGAnimation:(CCSVGAnimation *)animation restoreOriginalFrame:(BOOL)restoreOriginalFrame { 35 | NSAssert(animation != nil, @"Animate: argument Animation must be non-nil"); 36 | return [self initWithSVGAnimation:animation restoreOriginalFrame:restoreOriginalFrame duration:animation.duration]; 37 | } 38 | 39 | - (id)initWithSVGAnimation:(CCSVGAnimation *)animation restoreOriginalFrame:(BOOL)restoreOriginalFrame duration:(ccTime)duration { 40 | NSAssert(animation != nil, @"Animate: argument Animation must be non-nil"); 41 | 42 | if (( self = [super initWithDuration:duration])) { 43 | 44 | nextFrame_ = 0; 45 | restoreOriginalFrame_ = restoreOriginalFrame; 46 | self.animation = animation; 47 | origFrame_ = nil; 48 | 49 | splitTimes_ = [[NSMutableArray alloc] initWithCapacity:animation.frames.count]; 50 | 51 | float accumUnitsOfTime = 0; 52 | float newUnitOfTimeValue = duration / animation.totalDelayUnits; 53 | 54 | for (CCSVGAnimationFrame *frame in animation.frames) { 55 | 56 | NSNumber *value = [NSNumber numberWithFloat: (accumUnitsOfTime * newUnitOfTimeValue) / duration]; 57 | accumUnitsOfTime += frame.delayUnits; 58 | 59 | [splitTimes_ addObject:value]; 60 | } 61 | } 62 | return self; 63 | } 64 | 65 | 66 | - (id)copyWithZone: (NSZone*) zone { 67 | return [[[self class] allocWithZone: zone] initWithSVGAnimation:animation_ restoreOriginalFrame:restoreOriginalFrame_ duration:duration_]; 68 | } 69 | 70 | - (void)dealloc { 71 | [splitTimes_ release]; 72 | [animation_ release]; 73 | [origFrame_ release]; 74 | [super dealloc]; 75 | } 76 | 77 | 78 | #pragma mark 79 | 80 | - (void)startWithTarget:(id)aTarget { 81 | 82 | [super startWithTarget:aTarget]; 83 | 84 | CCSVGSprite *node = target_; 85 | 86 | [origFrame_ release]; 87 | 88 | if (restoreOriginalFrame_) { 89 | origFrame_ = [[node source] retain]; 90 | } 91 | 92 | nextFrame_ = 0; 93 | } 94 | 95 | - (void)stop { 96 | if( restoreOriginalFrame_ ) { 97 | CCSVGSprite *node = target_; 98 | node.source = origFrame_; 99 | } 100 | 101 | [super stop]; 102 | } 103 | 104 | - (void)update:(ccTime) t { 105 | NSArray *frames = [animation_ frames]; 106 | NSUInteger numberOfFrames = [frames count]; 107 | CCSVGSource *frameToDisplay = nil; 108 | 109 | for( NSUInteger i=nextFrame_; i < numberOfFrames; i++ ) { 110 | NSNumber *splitTime = [splitTimes_ objectAtIndex:i]; 111 | 112 | if( [splitTime floatValue] <= t ) { 113 | CCSVGAnimationFrame *frame = [frames objectAtIndex:i]; 114 | frameToDisplay = [frame source]; 115 | [(CCSVGSprite *)target_ setSource: frameToDisplay]; 116 | // TODO: 117 | // NSDictionary *dict = [frame userInfo]; 118 | // if( dict ) 119 | // [[NSNotificationCenter defaultCenter] postNotificationName:CCSVGAnimationFrameDisplayedNotification object:target_ userInfo:dict]; 120 | 121 | nextFrame_ = i+1; 122 | 123 | break; 124 | } 125 | } 126 | } 127 | 128 | - (CCActionInterval *)reverse { 129 | NSArray *oldArray = [animation_ frames]; 130 | NSMutableArray *newArray = [NSMutableArray arrayWithCapacity:[oldArray count]]; 131 | NSEnumerator *enumerator = [oldArray reverseObjectEnumerator]; 132 | for (id element in enumerator) 133 | [newArray addObject:[[element copy] autorelease]]; 134 | 135 | CCSVGAnimation *newAnim = [CCSVGAnimation animationWithFrames:newArray delayPerUnit:animation_.delayPerUnit]; 136 | return [[self class] actionWithSVGAnimation:newAnim restoreOriginalFrame:restoreOriginalFrame_ duration:duration_]; 137 | } 138 | 139 | @end 140 | -------------------------------------------------------------------------------- /src/CCSVGAnimation.mm: -------------------------------------------------------------------------------- 1 | #import "ccMacros.h" 2 | #import "CCSVGAnimation.h" 3 | #import "CCSVGCache.h" 4 | #import "CCSVGSource.h" 5 | 6 | 7 | #pragma mark - CCSVGAnimationFrame 8 | 9 | @implementation CCSVGAnimationFrame 10 | 11 | 12 | #pragma mark 13 | 14 | @synthesize delayUnits = delayUnits_; 15 | 16 | @synthesize source = source_; 17 | 18 | @synthesize userInfo = userInfo_; 19 | 20 | 21 | #pragma mark 22 | 23 | - (id)initWithSource:(CCSVGSource *)source delayUnits:(float)delayUnits userInfo:(NSDictionary*)userInfo { 24 | if (( self = [super init])) { 25 | self.delayUnits = delayUnits; 26 | self.source = source; 27 | self.userInfo = userInfo; 28 | } 29 | return self; 30 | } 31 | 32 | - (void)dealloc { 33 | CCLOGINFO( @"cocos2d: deallocing %@", self); 34 | [source_ release]; 35 | [userInfo_ release]; 36 | [super dealloc]; 37 | } 38 | 39 | - (id)copyWithZone:(NSZone *)zone { 40 | 41 | CCSVGSource *source; 42 | source = [[self.source copy] autorelease]; 43 | 44 | NSDictionary *userInfo; 45 | userInfo = [[self.userInfo copy] autorelease]; 46 | 47 | CCSVGAnimationFrame *copy; 48 | copy = [[[self class] allocWithZone:zone] initWithSource:source delayUnits:self.delayUnits userInfo:userInfo]; 49 | 50 | return copy; 51 | 52 | } 53 | 54 | - (NSString *)description { 55 | return [NSString stringWithFormat:@"<%@ = %p | Source = %p, delayUnits = %0.2f >", [self class], self, self.source, self.delayUnits]; 56 | } 57 | 58 | 59 | @end 60 | 61 | 62 | #pragma mark - CCSVGAnimation 63 | 64 | @implementation CCSVGAnimation 65 | 66 | 67 | #pragma mark 68 | 69 | - (CGRect)contentRect { 70 | return ((CCSVGAnimationFrame *)[self.frames objectAtIndex:0]).source.contentRect; 71 | } 72 | 73 | - (CGSize)contentSize { 74 | return self.contentRect.size; 75 | } 76 | 77 | @synthesize delayPerUnit = delayPerUnit_; 78 | 79 | @synthesize duration = duration_; 80 | 81 | @synthesize frames = frames_; 82 | 83 | @synthesize restoreOriginalFrame = restoreOriginalFrame_; 84 | 85 | @synthesize totalDelayUnits = totalDelayUnits_; 86 | 87 | 88 | #pragma mark 89 | 90 | + (id)animation { 91 | return [[[self alloc] init] autorelease]; 92 | } 93 | 94 | + (id)animationWithSources:(NSArray *)sources { 95 | return [[[self alloc] initWithSources:sources] autorelease]; 96 | } 97 | 98 | + (id)animationWithSources:(NSArray *)sources delay:(float)delay { 99 | return [[[self alloc] initWithSources:sources delay:delay] autorelease]; 100 | } 101 | 102 | + (id)animationWithFrames:(NSArray *)frames delayPerUnit:(float)delayPerUnit { 103 | return [[[self alloc] initWithFrames:frames delayPerUnit:delayPerUnit] autorelease]; 104 | } 105 | 106 | + (id)animationWithSourcesNamed:(NSString *)format count:(NSUInteger)count delay:(float)delay { 107 | 108 | NSMutableArray *sources; 109 | sources = [NSMutableArray arrayWithCapacity:count]; 110 | 111 | for (NSUInteger index = 0; index < count; index++) { 112 | 113 | NSString *name; 114 | name = [NSString stringWithFormat:format, index + 1]; 115 | 116 | CCSVGSource *source; 117 | source = [[CCSVGCache sharedSVGCache] addFile:name]; 118 | 119 | [sources addObject:source]; 120 | 121 | } 122 | 123 | return [self animationWithSources:sources delay:delay]; 124 | 125 | } 126 | 127 | 128 | #pragma mark 129 | 130 | - (id)init { 131 | return [self initWithSources:nil delay:0]; 132 | } 133 | 134 | - (id)initWithSources:(NSArray *)sources { 135 | return [self initWithSources:sources delay:0]; 136 | } 137 | 138 | - (id)initWithSources:(NSArray *)sources delay:(float)delay { 139 | if ((self = [super init])) { 140 | 141 | self.frames = [NSMutableArray arrayWithCapacity:sources.count]; 142 | 143 | for (CCSVGSource *source in sources) { 144 | CCSVGAnimationFrame *frame; 145 | frame = [[CCSVGAnimationFrame alloc] initWithSource:source delayUnits:1 userInfo:nil]; 146 | [self.frames addObject:frame]; 147 | [frame release]; 148 | } 149 | 150 | self.delayPerUnit = delay; 151 | self.totalDelayUnits = sources.count; 152 | self.duration = self.delayPerUnit * self.totalDelayUnits; 153 | 154 | } 155 | return self; 156 | } 157 | 158 | - (id)initWithFrames:(NSArray *)frames delayPerUnit:(float)delayPerUnit { 159 | if ((self = [super init])) { 160 | 161 | self.delayPerUnit = delayPerUnit; 162 | self.duration = 0; 163 | 164 | self.frames = [NSMutableArray arrayWithArray:frames]; 165 | for (CCSVGAnimationFrame *frame in frames) { 166 | self.duration += frame.delayUnits * delayPerUnit; 167 | self.totalDelayUnits += frame.delayUnits; 168 | } 169 | 170 | } 171 | return self; 172 | } 173 | 174 | - (void)dealloc { 175 | CCLOGINFO( @"cocos2d: deallocing %@",self); 176 | [frames_ release]; 177 | [super dealloc]; 178 | } 179 | 180 | - (NSString *)description { 181 | return [NSString stringWithFormat:@"<%@ = %p | frames=%d, totalDelayUnits=%f, delayPerUnit=%0.2f>", 182 | [self class], 183 | self, 184 | self.frames.count, 185 | self.totalDelayUnits, 186 | self.delayPerUnit]; 187 | } 188 | 189 | 190 | #pragma mark 191 | 192 | - (void)addFrameWithSource:(CCSVGSource *)source { 193 | 194 | CCSVGAnimationFrame *frame; 195 | frame = [[CCSVGAnimationFrame alloc] initWithSource:source delayUnits:1 userInfo:nil]; 196 | [self.frames addObject:frame]; 197 | [frame release]; 198 | 199 | self.duration += self.delayPerUnit; 200 | self.totalDelayUnits++; 201 | 202 | } 203 | 204 | - (void)addFrameWithSource:(CCSVGSource *)source delay:(float)delay { 205 | 206 | if (self.delayPerUnit == 0) { 207 | self.delayPerUnit = delay; 208 | } 209 | 210 | float delayUnits; 211 | delayUnits = delay / self.delayPerUnit; 212 | 213 | CCSVGAnimationFrame *frame; 214 | frame = [[CCSVGAnimationFrame alloc] initWithSource:source delayUnits:delayUnits userInfo:nil]; 215 | [self.frames addObject:frame]; 216 | [frame release]; 217 | 218 | self.duration += delay; 219 | self.totalDelayUnits += delayUnits; 220 | 221 | } 222 | 223 | - (void)addFrameWithSourceNamed:(NSString *)name { 224 | 225 | CCSVGSource *source; 226 | source = [[CCSVGCache sharedSVGCache] addFile:name]; 227 | [self addFrameWithSource:source]; 228 | 229 | } 230 | 231 | #pragma mark 232 | 233 | - (void)optimize { 234 | for (CCSVGAnimationFrame *frame in self.frames) { 235 | [frame.source optimize]; 236 | } 237 | } 238 | 239 | 240 | @end 241 | -------------------------------------------------------------------------------- /example/CCSVGExample/en.lproj/bird_0001.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /example/CCSVGExample/en.lproj/bird_0002.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /src/CCSVGAnimationCache.mm: -------------------------------------------------------------------------------- 1 | #import "ccMacros.h" 2 | #import "CCSVGAnimation.h" 3 | #import "CCSVGAnimationCache.h" 4 | #import "CCSVGCache.h" 5 | #import "CCSVGSource.h" 6 | #import "Support/CCFileUtils.h" 7 | 8 | 9 | #pragma mark - CCSVGAnimationCache 10 | 11 | @interface CCSVGAnimationCache () 12 | 13 | 14 | #pragma mark 15 | 16 | @property (readwrite, retain) NSMutableDictionary *animations; 17 | 18 | 19 | @end 20 | 21 | 22 | 23 | #pragma mark - CCSVGAnimationCache 24 | 25 | @implementation CCSVGAnimationCache 26 | 27 | 28 | #pragma mark 29 | 30 | static CCSVGAnimationCache *sharedAnimationCache_ = nil; 31 | 32 | + (CCSVGAnimationCache *)sharedAnimationCache { 33 | if (!sharedAnimationCache_) { 34 | sharedAnimationCache_ = [[CCSVGAnimationCache alloc] init]; 35 | } 36 | return sharedAnimationCache_; 37 | } 38 | 39 | + (id)alloc { 40 | NSAssert(sharedAnimationCache_ == nil, @"Attempted to allocate a second instance of a singleton."); 41 | return [super alloc]; 42 | } 43 | 44 | + (void)purgeSharedAnimationCache { 45 | [sharedAnimationCache_ release]; 46 | sharedAnimationCache_ = nil; 47 | } 48 | 49 | 50 | #pragma mark 51 | 52 | @synthesize animations = animations_; 53 | 54 | 55 | #pragma mark 56 | 57 | - (id)init { 58 | if ((self = [super init])) { 59 | self.animations = [NSMutableDictionary dictionary]; 60 | } 61 | return self; 62 | } 63 | 64 | - (void)dealloc { 65 | CCLOGINFO(@"cocos2d: deallocing %@", self); 66 | [animations_ release]; 67 | [super dealloc]; 68 | } 69 | 70 | - (NSString *)description { 71 | return [NSString stringWithFormat:@"<%@ = %p | num of animations = %i>", 72 | [self class], 73 | self, 74 | self.animations.count]; 75 | } 76 | 77 | 78 | #pragma mark 79 | 80 | - (void)addAnimation:(CCSVGAnimation *)animation name:(NSString *)name { 81 | [self.animations setObject:animation forKey:name]; 82 | } 83 | 84 | - (void)removeAnimationByName:(NSString *)name { 85 | if (name) { 86 | [self.animations removeObjectForKey:name]; 87 | } 88 | } 89 | 90 | - (void)removeAllAnimations { 91 | [animations_ removeAllObjects]; 92 | } 93 | 94 | - (void)removeUnusedAnimations { 95 | NSArray *keys = [animations_ allKeys]; 96 | for (id key in keys) { 97 | id value = [animations_ objectForKey:key]; 98 | if ([value retainCount] == 1) { 99 | CCLOG(@"cocos2d: CCSVGAnimationCache: removing unused animation: %@", key); 100 | [animations_ removeObjectForKey:key]; 101 | } 102 | } 103 | } 104 | 105 | 106 | #pragma mark 107 | 108 | - (CCSVGAnimation *)animationByName:(NSString *)name { 109 | return [self.animations objectForKey:name]; 110 | } 111 | 112 | 113 | #pragma mark 114 | 115 | - (void)parseVersion1:(NSDictionary*)animations { 116 | 117 | NSArray *animationNames; 118 | animationNames = [animations allKeys]; 119 | 120 | for (NSString *animationName in animationNames) { 121 | 122 | NSDictionary *animationDictionary; 123 | animationDictionary = [animations objectForKey:animationName]; 124 | 125 | NSArray *sourceNames; 126 | sourceNames = [animationDictionary objectForKey:@"frames"]; 127 | 128 | NSNumber *delay; 129 | delay = [animationDictionary objectForKey:@"delay"]; 130 | 131 | if (sourceNames == nil) { 132 | CCLOG(@"cocos2d: CCSVGAnimationCache: Animation '%@' found in dictionary without any frames - cannot add to animation cache.", animationName); 133 | continue; 134 | } 135 | 136 | NSMutableArray *animationFrames; 137 | animationFrames = [NSMutableArray arrayWithCapacity:sourceNames.count]; 138 | 139 | for (NSString *sourceName in sourceNames) { 140 | 141 | CCSVGSource *source; 142 | source = [[CCSVGCache sharedSVGCache] addFile:sourceName]; 143 | 144 | if (!source) { 145 | CCLOG(@"cocos2d: CCSVGAnimationCache: Animation '%@' refers to source '%@' which is not currently in the CCSVGCache. This frame will not be added to the animation.", animationName, sourceName); 146 | continue; 147 | } 148 | 149 | CCSVGAnimationFrame *animationFrame; 150 | animationFrame = [[CCSVGAnimationFrame alloc] initWithSource:source delayUnits:1 userInfo:nil]; 151 | [animationFrames addObject:animationFrame]; 152 | [animationFrame release]; 153 | 154 | } 155 | 156 | if (animationFrames.count == 0) { 157 | CCLOG(@"cocos2d: CCSVGAnimationCache: None of the frames for animation '%@' were found in the CCSVGCache. Animation is not being added to the Animation Cache.", animationName); 158 | continue; 159 | } else if (animationFrames.count != sourceNames.count) { 160 | CCLOG(@"cocos2d: CCSVGAnimationCache: An animation in your dictionary refers to a frame which is not in the CCSVGCache. Some or all of the frames for the animation '%@' may be missing.", animationName); 161 | } 162 | 163 | 164 | CCSVGAnimation *animation; 165 | animation = [CCSVGAnimation animationWithFrames:animationFrames delayPerUnit:delay.floatValue]; 166 | [[CCSVGAnimationCache sharedAnimationCache] addAnimation:animation name:animationName]; 167 | 168 | } 169 | 170 | } 171 | 172 | - (void)parseVersion2:(NSDictionary*)animations { 173 | NSArray* animationNames = [animations allKeys]; 174 | CCSVGCache *frameCache = [CCSVGCache sharedSVGCache]; 175 | 176 | for( NSString *name in animationNames ) 177 | { 178 | NSDictionary* animationDict = [animations objectForKey:name]; 179 | 180 | // BOOL loop = [[animationDict objectForKey:@"loop"] boolValue]; 181 | BOOL restoreOriginalFrame = [[animationDict objectForKey:@"restoreOriginalFrame"] boolValue]; 182 | 183 | NSArray *frameArray = [animationDict objectForKey:@"frames"]; 184 | 185 | 186 | if ( frameArray == nil ) { 187 | CCLOG(@"cocos2d: CCSVGAnimationCache: Animation '%@' found in dictionary without any frames - cannot add to animation cache.", name); 188 | continue; 189 | } 190 | 191 | // Array of AnimationFrames 192 | NSMutableArray *array = [[NSMutableArray alloc] initWithCapacity:[frameArray count]]; 193 | 194 | for( NSDictionary *entry in frameArray ) { 195 | NSString *spriteFrameName = [entry objectForKey:@"spriteframe"]; 196 | CCSVGSource *spriteFrame = [frameCache sourceForKey:spriteFrameName]; 197 | 198 | if( ! spriteFrame ) { 199 | CCLOG(@"cocos2d: CCSVGAnimationCache: Animation '%@' refers to frame '%@' which is not currently in the CCSVGCache. This frame will not be added to the animation.", name, spriteFrameName); 200 | 201 | continue; 202 | } 203 | 204 | float delayUnits = [[entry objectForKey:@"delayUnits"] floatValue]; 205 | NSDictionary *userInfo = [entry objectForKey:@"notification"]; 206 | 207 | CCSVGAnimationFrame *animFrame = [[CCSVGAnimationFrame alloc] initWithSource:spriteFrame delayUnits:delayUnits userInfo:userInfo]; 208 | 209 | [array addObject:animFrame]; 210 | [animFrame release]; 211 | } 212 | 213 | float delayPerUnit = [[animationDict objectForKey:@"delayPerUnit"] floatValue]; 214 | CCSVGAnimation *animation = [[CCSVGAnimation alloc] initWithFrames:array delayPerUnit:delayPerUnit]; 215 | [array release]; 216 | 217 | [animation setRestoreOriginalFrame:restoreOriginalFrame]; 218 | 219 | [[CCSVGAnimationCache sharedAnimationCache] addAnimation:animation name:name]; 220 | [animation release]; 221 | } 222 | } 223 | 224 | - (void)addAnimationsWithDictionary:(NSDictionary *)dictionary { 225 | NSDictionary *animations = [dictionary objectForKey:@"animations"]; 226 | 227 | if ( animations == nil ) { 228 | CCLOG(@"cocos2d: CCSVGAnimationCache: No animations were found in provided dictionary."); 229 | return; 230 | } 231 | 232 | NSUInteger version = 1; 233 | NSDictionary *properties = [dictionary objectForKey:@"properties"]; 234 | if( properties ) 235 | version = [[properties objectForKey:@"format"] intValue]; 236 | 237 | NSArray *spritesheets = [properties objectForKey:@"spritesheets"]; 238 | for( NSString *name in spritesheets ) { 239 | // [[CCSVGCache sharedSVGCache] addSVGsWithFile:name]; 240 | } 241 | 242 | switch (version) { 243 | case 1: 244 | [self parseVersion1:animations]; 245 | break; 246 | case 2: 247 | [self parseVersion2:animations]; 248 | break; 249 | default: 250 | NSAssert(NO, @"Invalid animation format"); 251 | } 252 | } 253 | 254 | - (void)addAnimationsWithFile:(NSString *)plist { 255 | NSAssert( plist, @"Invalid texture file name"); 256 | 257 | NSString *path = [CCFileUtils fullPathFromRelativePath:plist]; 258 | NSDictionary *dict = [NSDictionary dictionaryWithContentsOfFile:path]; 259 | 260 | NSAssert1( dict, @"CCSVGAnimationCache: File could not be found: %@", plist); 261 | 262 | 263 | [self addAnimationsWithDictionary:dict]; 264 | } 265 | 266 | 267 | @end 268 | 269 | -------------------------------------------------------------------------------- /CCSVG.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 3E83151C1573FA6E0086129D /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3E83151B1573FA6E0086129D /* Foundation.framework */; }; 11 | 3E83153C1573FAEE0086129D /* CCSVGAnimate.h in Headers */ = {isa = PBXBuildFile; fileRef = 3E8315301573FAEE0086129D /* CCSVGAnimate.h */; settings = {ATTRIBUTES = (Public, ); }; }; 12 | 3E83153D1573FAEE0086129D /* CCSVGAnimate.mm in Sources */ = {isa = PBXBuildFile; fileRef = 3E8315311573FAEE0086129D /* CCSVGAnimate.mm */; }; 13 | 3E83153E1573FAEE0086129D /* CCSVGAnimation.h in Headers */ = {isa = PBXBuildFile; fileRef = 3E8315321573FAEE0086129D /* CCSVGAnimation.h */; settings = {ATTRIBUTES = (Public, ); }; }; 14 | 3E83153F1573FAEE0086129D /* CCSVGAnimation.mm in Sources */ = {isa = PBXBuildFile; fileRef = 3E8315331573FAEE0086129D /* CCSVGAnimation.mm */; }; 15 | 3E8315401573FAEE0086129D /* CCSVGAnimationCache.h in Headers */ = {isa = PBXBuildFile; fileRef = 3E8315341573FAEE0086129D /* CCSVGAnimationCache.h */; settings = {ATTRIBUTES = (Public, ); }; }; 16 | 3E8315411573FAEE0086129D /* CCSVGAnimationCache.mm in Sources */ = {isa = PBXBuildFile; fileRef = 3E8315351573FAEE0086129D /* CCSVGAnimationCache.mm */; }; 17 | 3E8315421573FAEE0086129D /* CCSVGCache.h in Headers */ = {isa = PBXBuildFile; fileRef = 3E8315361573FAEE0086129D /* CCSVGCache.h */; settings = {ATTRIBUTES = (Public, ); }; }; 18 | 3E8315431573FAEE0086129D /* CCSVGCache.mm in Sources */ = {isa = PBXBuildFile; fileRef = 3E8315371573FAEE0086129D /* CCSVGCache.mm */; }; 19 | 3E8315441573FAEE0086129D /* CCSVGSprite.h in Headers */ = {isa = PBXBuildFile; fileRef = 3E8315381573FAEE0086129D /* CCSVGSprite.h */; settings = {ATTRIBUTES = (Public, ); }; }; 20 | 3E8315451573FAEE0086129D /* CCSVGSprite.mm in Sources */ = {isa = PBXBuildFile; fileRef = 3E8315391573FAEE0086129D /* CCSVGSprite.mm */; }; 21 | 3E8315461573FAEE0086129D /* CCSVGSource.h in Headers */ = {isa = PBXBuildFile; fileRef = 3E83153A1573FAEE0086129D /* CCSVGSource.h */; settings = {ATTRIBUTES = (Public, ); }; }; 22 | 3E8315471573FAEE0086129D /* CCSVGSource.mm in Sources */ = {isa = PBXBuildFile; fileRef = 3E83153B1573FAEE0086129D /* CCSVGSource.mm */; }; 23 | 3E83163A1574100D0086129D /* CCSVG.h in Headers */ = {isa = PBXBuildFile; fileRef = 3E8315201573FA6E0086129D /* CCSVG.h */; settings = {ATTRIBUTES = (Public, ); }; }; 24 | /* End PBXBuildFile section */ 25 | 26 | /* Begin PBXFileReference section */ 27 | 3E8315181573FA6E0086129D /* libCCSVG.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libCCSVG.a; sourceTree = BUILT_PRODUCTS_DIR; }; 28 | 3E83151B1573FA6E0086129D /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; 29 | 3E8315201573FA6E0086129D /* CCSVG.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CCSVG.h; sourceTree = ""; }; 30 | 3E8315301573FAEE0086129D /* CCSVGAnimate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCSVGAnimate.h; sourceTree = ""; }; 31 | 3E8315311573FAEE0086129D /* CCSVGAnimate.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = CCSVGAnimate.mm; sourceTree = ""; }; 32 | 3E8315321573FAEE0086129D /* CCSVGAnimation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCSVGAnimation.h; sourceTree = ""; }; 33 | 3E8315331573FAEE0086129D /* CCSVGAnimation.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = CCSVGAnimation.mm; sourceTree = ""; }; 34 | 3E8315341573FAEE0086129D /* CCSVGAnimationCache.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCSVGAnimationCache.h; sourceTree = ""; }; 35 | 3E8315351573FAEE0086129D /* CCSVGAnimationCache.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = CCSVGAnimationCache.mm; sourceTree = ""; }; 36 | 3E8315361573FAEE0086129D /* CCSVGCache.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCSVGCache.h; sourceTree = ""; }; 37 | 3E8315371573FAEE0086129D /* CCSVGCache.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = CCSVGCache.mm; sourceTree = ""; }; 38 | 3E8315381573FAEE0086129D /* CCSVGSprite.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCSVGSprite.h; sourceTree = ""; }; 39 | 3E8315391573FAEE0086129D /* CCSVGSprite.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = CCSVGSprite.mm; sourceTree = ""; }; 40 | 3E83153A1573FAEE0086129D /* CCSVGSource.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCSVGSource.h; sourceTree = ""; }; 41 | 3E83153B1573FAEE0086129D /* CCSVGSource.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = CCSVGSource.mm; sourceTree = ""; }; 42 | /* End PBXFileReference section */ 43 | 44 | /* Begin PBXFrameworksBuildPhase section */ 45 | 3E8315151573FA6E0086129D /* Frameworks */ = { 46 | isa = PBXFrameworksBuildPhase; 47 | buildActionMask = 2147483647; 48 | files = ( 49 | 3E83151C1573FA6E0086129D /* Foundation.framework in Frameworks */, 50 | ); 51 | runOnlyForDeploymentPostprocessing = 0; 52 | }; 53 | /* End PBXFrameworksBuildPhase section */ 54 | 55 | /* Begin PBXGroup section */ 56 | 3E83150D1573FA6E0086129D = { 57 | isa = PBXGroup; 58 | children = ( 59 | 3E83151D1573FA6E0086129D /* Source */, 60 | 3E83151A1573FA6E0086129D /* Frameworks */, 61 | 3E8315191573FA6E0086129D /* Products */, 62 | ); 63 | sourceTree = ""; 64 | }; 65 | 3E8315191573FA6E0086129D /* Products */ = { 66 | isa = PBXGroup; 67 | children = ( 68 | 3E8315181573FA6E0086129D /* libCCSVG.a */, 69 | ); 70 | name = Products; 71 | sourceTree = ""; 72 | }; 73 | 3E83151A1573FA6E0086129D /* Frameworks */ = { 74 | isa = PBXGroup; 75 | children = ( 76 | 3E83151B1573FA6E0086129D /* Foundation.framework */, 77 | ); 78 | name = Frameworks; 79 | sourceTree = ""; 80 | }; 81 | 3E83151D1573FA6E0086129D /* Source */ = { 82 | isa = PBXGroup; 83 | children = ( 84 | 3E8315201573FA6E0086129D /* CCSVG.h */, 85 | 3E8315301573FAEE0086129D /* CCSVGAnimate.h */, 86 | 3E8315311573FAEE0086129D /* CCSVGAnimate.mm */, 87 | 3E8315321573FAEE0086129D /* CCSVGAnimation.h */, 88 | 3E8315331573FAEE0086129D /* CCSVGAnimation.mm */, 89 | 3E8315341573FAEE0086129D /* CCSVGAnimationCache.h */, 90 | 3E8315351573FAEE0086129D /* CCSVGAnimationCache.mm */, 91 | 3E8315361573FAEE0086129D /* CCSVGCache.h */, 92 | 3E8315371573FAEE0086129D /* CCSVGCache.mm */, 93 | 3E8315381573FAEE0086129D /* CCSVGSprite.h */, 94 | 3E8315391573FAEE0086129D /* CCSVGSprite.mm */, 95 | 3E83153A1573FAEE0086129D /* CCSVGSource.h */, 96 | 3E83153B1573FAEE0086129D /* CCSVGSource.mm */, 97 | ); 98 | name = Source; 99 | path = src; 100 | sourceTree = ""; 101 | }; 102 | /* End PBXGroup section */ 103 | 104 | /* Begin PBXHeadersBuildPhase section */ 105 | 3E8315161573FA6E0086129D /* Headers */ = { 106 | isa = PBXHeadersBuildPhase; 107 | buildActionMask = 2147483647; 108 | files = ( 109 | 3E83163A1574100D0086129D /* CCSVG.h in Headers */, 110 | 3E83153C1573FAEE0086129D /* CCSVGAnimate.h in Headers */, 111 | 3E83153E1573FAEE0086129D /* CCSVGAnimation.h in Headers */, 112 | 3E8315401573FAEE0086129D /* CCSVGAnimationCache.h in Headers */, 113 | 3E8315421573FAEE0086129D /* CCSVGCache.h in Headers */, 114 | 3E8315441573FAEE0086129D /* CCSVGSprite.h in Headers */, 115 | 3E8315461573FAEE0086129D /* CCSVGSource.h in Headers */, 116 | ); 117 | runOnlyForDeploymentPostprocessing = 0; 118 | }; 119 | /* End PBXHeadersBuildPhase section */ 120 | 121 | /* Begin PBXNativeTarget section */ 122 | 3E8315171573FA6E0086129D /* CCSVG */ = { 123 | isa = PBXNativeTarget; 124 | buildConfigurationList = 3E8315251573FA6E0086129D /* Build configuration list for PBXNativeTarget "CCSVG" */; 125 | buildPhases = ( 126 | 3E8315161573FA6E0086129D /* Headers */, 127 | 3E8315141573FA6E0086129D /* Sources */, 128 | 3E8315151573FA6E0086129D /* Frameworks */, 129 | ); 130 | buildRules = ( 131 | ); 132 | dependencies = ( 133 | ); 134 | name = CCSVG; 135 | productName = CCSVG; 136 | productReference = 3E8315181573FA6E0086129D /* libCCSVG.a */; 137 | productType = "com.apple.product-type.library.static"; 138 | }; 139 | /* End PBXNativeTarget section */ 140 | 141 | /* Begin PBXProject section */ 142 | 3E83150F1573FA6E0086129D /* Project object */ = { 143 | isa = PBXProject; 144 | attributes = { 145 | LastUpgradeCheck = 0430; 146 | }; 147 | buildConfigurationList = 3E8315121573FA6E0086129D /* Build configuration list for PBXProject "CCSVG" */; 148 | compatibilityVersion = "Xcode 3.2"; 149 | developmentRegion = English; 150 | hasScannedForEncodings = 0; 151 | knownRegions = ( 152 | en, 153 | ); 154 | mainGroup = 3E83150D1573FA6E0086129D; 155 | productRefGroup = 3E8315191573FA6E0086129D /* Products */; 156 | projectDirPath = ""; 157 | projectRoot = ""; 158 | targets = ( 159 | 3E8315171573FA6E0086129D /* CCSVG */, 160 | ); 161 | }; 162 | /* End PBXProject section */ 163 | 164 | /* Begin PBXSourcesBuildPhase section */ 165 | 3E8315141573FA6E0086129D /* Sources */ = { 166 | isa = PBXSourcesBuildPhase; 167 | buildActionMask = 2147483647; 168 | files = ( 169 | 3E83153D1573FAEE0086129D /* CCSVGAnimate.mm in Sources */, 170 | 3E83153F1573FAEE0086129D /* CCSVGAnimation.mm in Sources */, 171 | 3E8315411573FAEE0086129D /* CCSVGAnimationCache.mm in Sources */, 172 | 3E8315431573FAEE0086129D /* CCSVGCache.mm in Sources */, 173 | 3E8315451573FAEE0086129D /* CCSVGSprite.mm in Sources */, 174 | 3E8315471573FAEE0086129D /* CCSVGSource.mm in Sources */, 175 | ); 176 | runOnlyForDeploymentPostprocessing = 0; 177 | }; 178 | /* End PBXSourcesBuildPhase section */ 179 | 180 | /* Begin XCBuildConfiguration section */ 181 | 3E8315231573FA6E0086129D /* Debug */ = { 182 | isa = XCBuildConfiguration; 183 | buildSettings = { 184 | ALWAYS_SEARCH_USER_PATHS = NO; 185 | ARCHS = "$(ARCHS_STANDARD_32_BIT)"; 186 | COPY_PHASE_STRIP = NO; 187 | GCC_C_LANGUAGE_STANDARD = gnu99; 188 | GCC_DYNAMIC_NO_PIC = NO; 189 | GCC_OPTIMIZATION_LEVEL = 0; 190 | GCC_PREPROCESSOR_DEFINITIONS = ( 191 | "DEBUG=1", 192 | "$(inherited)", 193 | ); 194 | GCC_SYMBOLS_PRIVATE_EXTERN = YES; 195 | GCC_VERSION = com.apple.compilers.llvm.clang.1_0; 196 | GCC_WARN_ABOUT_RETURN_TYPE = YES; 197 | GCC_WARN_UNINITIALIZED_AUTOS = YES; 198 | GCC_WARN_UNUSED_VARIABLE = YES; 199 | IPHONEOS_DEPLOYMENT_TARGET = 5.1; 200 | SDKROOT = iphoneos; 201 | }; 202 | name = Debug; 203 | }; 204 | 3E8315241573FA6E0086129D /* Release */ = { 205 | isa = XCBuildConfiguration; 206 | buildSettings = { 207 | ALWAYS_SEARCH_USER_PATHS = NO; 208 | ARCHS = "$(ARCHS_STANDARD_32_BIT)"; 209 | COPY_PHASE_STRIP = YES; 210 | GCC_C_LANGUAGE_STANDARD = gnu99; 211 | GCC_SYMBOLS_PRIVATE_EXTERN = YES; 212 | GCC_VERSION = com.apple.compilers.llvm.clang.1_0; 213 | GCC_WARN_ABOUT_RETURN_TYPE = YES; 214 | GCC_WARN_UNINITIALIZED_AUTOS = YES; 215 | GCC_WARN_UNUSED_VARIABLE = YES; 216 | IPHONEOS_DEPLOYMENT_TARGET = 5.1; 217 | SDKROOT = iphoneos; 218 | VALIDATE_PRODUCT = YES; 219 | }; 220 | name = Release; 221 | }; 222 | 3E8315261573FA6E0086129D /* Debug */ = { 223 | isa = XCBuildConfiguration; 224 | buildSettings = { 225 | DSTROOT = /tmp/CCSVG.dst; 226 | FRAMEWORK_SEARCH_PATHS = ( 227 | "$(inherited)", 228 | "\"$(SRCROOT)/../MonkVG/Frameworks\"", 229 | "\"$(SRCROOT)/external/MonkVG/Frameworks\"", 230 | ); 231 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 232 | HEADER_SEARCH_PATHS = ( 233 | "$(inherited)", 234 | "\"$(SRCROOT)/../cocos2d-iphone/cocos2d\"/**", 235 | "\"$(SRCROOT)/external/cocos2d-iphone/cocos2d\"/**", 236 | "\"$(TARGET_BUILD_DIR)/include\"", 237 | "\"$(OBJROOT)/UninstalledProducts/include\"", 238 | ); 239 | LIBRARY_SEARCH_PATHS = ( 240 | "\"$(SRCROOT)/../../Library/Developer/Xcode/DerivedData/CCSVG-cezvfgarawfetrcrsoqurzoiacbw/Build/Products/Debug-iphoneos\"", 241 | "$(inherited)", 242 | ); 243 | OTHER_LDFLAGS = "-ObjC"; 244 | PRODUCT_NAME = "$(TARGET_NAME)"; 245 | PUBLIC_HEADERS_FOLDER_PATH = include/$TARGET_NAME; 246 | SKIP_INSTALL = YES; 247 | }; 248 | name = Debug; 249 | }; 250 | 3E8315271573FA6E0086129D /* Release */ = { 251 | isa = XCBuildConfiguration; 252 | buildSettings = { 253 | DSTROOT = /tmp/CCSVG.dst; 254 | FRAMEWORK_SEARCH_PATHS = ( 255 | "$(inherited)", 256 | "\"$(SRCROOT)/../MonkVG/Frameworks\"", 257 | "\"$(SRCROOT)/external/MonkVG/Frameworks\"", 258 | ); 259 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 260 | HEADER_SEARCH_PATHS = ( 261 | "$(inherited)", 262 | "\"$(SRCROOT)/../cocos2d-iphone/cocos2d\"/**", 263 | "\"$(SRCROOT)/external/cocos2d-iphone/cocos2d\"/**", 264 | "\"$(TARGET_BUILD_DIR)/include\"", 265 | "\"$(OBJROOT)/UninstalledProducts/include\"", 266 | ); 267 | LIBRARY_SEARCH_PATHS = ( 268 | "\"$(SRCROOT)/../../Library/Developer/Xcode/DerivedData/CCSVG-cezvfgarawfetrcrsoqurzoiacbw/Build/Products/Debug-iphoneos\"", 269 | "$(inherited)", 270 | ); 271 | OTHER_LDFLAGS = "-ObjC"; 272 | PRODUCT_NAME = "$(TARGET_NAME)"; 273 | PUBLIC_HEADERS_FOLDER_PATH = include/$TARGET_NAME; 274 | SKIP_INSTALL = YES; 275 | }; 276 | name = Release; 277 | }; 278 | /* End XCBuildConfiguration section */ 279 | 280 | /* Begin XCConfigurationList section */ 281 | 3E8315121573FA6E0086129D /* Build configuration list for PBXProject "CCSVG" */ = { 282 | isa = XCConfigurationList; 283 | buildConfigurations = ( 284 | 3E8315231573FA6E0086129D /* Debug */, 285 | 3E8315241573FA6E0086129D /* Release */, 286 | ); 287 | defaultConfigurationIsVisible = 0; 288 | defaultConfigurationName = Release; 289 | }; 290 | 3E8315251573FA6E0086129D /* Build configuration list for PBXNativeTarget "CCSVG" */ = { 291 | isa = XCConfigurationList; 292 | buildConfigurations = ( 293 | 3E8315261573FA6E0086129D /* Debug */, 294 | 3E8315271573FA6E0086129D /* Release */, 295 | ); 296 | defaultConfigurationIsVisible = 0; 297 | defaultConfigurationName = Release; 298 | }; 299 | /* End XCConfigurationList section */ 300 | }; 301 | rootObject = 3E83150F1573FA6E0086129D /* Project object */; 302 | } 303 | -------------------------------------------------------------------------------- /example/CCSVGExample.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 3E8315BD157409C00086129D /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3E8315BC157409C00086129D /* UIKit.framework */; }; 11 | 3E8315BF157409C00086129D /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3E8315BE157409C00086129D /* Foundation.framework */; }; 12 | 3E8315C1157409C00086129D /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3E8315C0157409C00086129D /* CoreGraphics.framework */; }; 13 | 3E8315C7157409C00086129D /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 3E8315C5157409C00086129D /* InfoPlist.strings */; }; 14 | 3E8315C9157409C00086129D /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 3E8315C8157409C00086129D /* main.m */; }; 15 | 3E8315CD157409C00086129D /* AppDelegate.mm in Sources */ = {isa = PBXBuildFile; fileRef = 3E8315CC157409C00086129D /* AppDelegate.mm */; }; 16 | 3E8315E715740A910086129D /* libCCSVG.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 3E8315E615740A910086129D /* libCCSVG.a */; }; 17 | 3E83163215740B560086129D /* OpenGLES.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3E83162D15740B560086129D /* OpenGLES.framework */; }; 18 | 3E83163315740B560086129D /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3E83162E15740B560086129D /* QuartzCore.framework */; }; 19 | 3E83163715740B7D0086129D /* libcocos2d.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 3E83163415740B7D0086129D /* libcocos2d.a */; }; 20 | 3E83163815740B7D0086129D /* libMonkSVG_iOS.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 3E83163515740B7D0086129D /* libMonkSVG_iOS.a */; }; 21 | 3E83163915740B7D0086129D /* libMonkVG_iOS_OpenGL.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 3E83163615740B7D0086129D /* libMonkVG_iOS_OpenGL.a */; }; 22 | 3E83163D157411C10086129D /* libz.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 3E83163C157411C10086129D /* libz.dylib */; }; 23 | 3E831644157412060086129D /* bird_0001.svg in Resources */ = {isa = PBXBuildFile; fileRef = 3E831640157412060086129D /* bird_0001.svg */; }; 24 | 3E831645157412060086129D /* bird_0002.svg in Resources */ = {isa = PBXBuildFile; fileRef = 3E831642157412060086129D /* bird_0002.svg */; }; 25 | 3E83172E157512560086129D /* boost.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3E83172D157512560086129D /* boost.framework */; }; 26 | 3ED1A1AC15755F9D00600410 /* fps_images-hd.png in Resources */ = {isa = PBXBuildFile; fileRef = 3ED1A1AA15755F9C00600410 /* fps_images-hd.png */; }; 27 | 3ED1A1AD15755F9D00600410 /* fps_images.png in Resources */ = {isa = PBXBuildFile; fileRef = 3ED1A1AB15755F9C00600410 /* fps_images.png */; }; 28 | /* End PBXBuildFile section */ 29 | 30 | /* Begin PBXFileReference section */ 31 | 3E8315B8157409C00086129D /* CCSVGExample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = CCSVGExample.app; sourceTree = BUILT_PRODUCTS_DIR; }; 32 | 3E8315BC157409C00086129D /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; }; 33 | 3E8315BE157409C00086129D /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; 34 | 3E8315C0157409C00086129D /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; 35 | 3E8315C4157409C00086129D /* CCSVGExample-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "CCSVGExample-Info.plist"; sourceTree = ""; }; 36 | 3E8315C6157409C00086129D /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; 37 | 3E8315C8157409C00086129D /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 38 | 3E8315CA157409C00086129D /* CCSVGExample-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "CCSVGExample-Prefix.pch"; sourceTree = ""; }; 39 | 3E8315CB157409C00086129D /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 40 | 3E8315CC157409C00086129D /* AppDelegate.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = AppDelegate.mm; sourceTree = ""; }; 41 | 3E8315E615740A910086129D /* libCCSVG.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = libCCSVG.a; sourceTree = BUILT_PRODUCTS_DIR; }; 42 | 3E83162D15740B560086129D /* OpenGLES.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenGLES.framework; path = System/Library/Frameworks/OpenGLES.framework; sourceTree = SDKROOT; }; 43 | 3E83162E15740B560086129D /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; }; 44 | 3E83163415740B7D0086129D /* libcocos2d.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libcocos2d.a; path = "../../../Library/Developer/Xcode/DerivedData/CCSVGExample-fwgscebjqlupvmflufrhkxxrhyub/Build/Products/Debug-iphoneos/libcocos2d.a"; sourceTree = ""; }; 45 | 3E83163515740B7D0086129D /* libMonkSVG_iOS.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libMonkSVG_iOS.a; path = "../../../Library/Developer/Xcode/DerivedData/CCSVGExample-fwgscebjqlupvmflufrhkxxrhyub/Build/Products/Debug-iphoneos/libMonkSVG_iOS.a"; sourceTree = ""; }; 46 | 3E83163615740B7D0086129D /* libMonkVG_iOS_OpenGL.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libMonkVG_iOS_OpenGL.a; path = "../../../Library/Developer/Xcode/DerivedData/CCSVGExample-fwgscebjqlupvmflufrhkxxrhyub/Build/Products/Debug-iphoneos/libMonkVG_iOS_OpenGL.a"; sourceTree = ""; }; 47 | 3E83163C157411C10086129D /* libz.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libz.dylib; path = usr/lib/libz.dylib; sourceTree = SDKROOT; }; 48 | 3E831641157412060086129D /* en */ = {isa = PBXFileReference; lastKnownFileType = text.xml; name = en; path = en.lproj/bird_0001.svg; sourceTree = ""; }; 49 | 3E831643157412060086129D /* en */ = {isa = PBXFileReference; lastKnownFileType = text.xml; name = en; path = en.lproj/bird_0002.svg; sourceTree = ""; }; 50 | 3E83172D157512560086129D /* boost.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = boost.framework; path = ../external/MonkVG/Frameworks/boost.framework; sourceTree = ""; }; 51 | 3ED1A1AA15755F9C00600410 /* fps_images-hd.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "fps_images-hd.png"; path = "../../external/cocos2d-iphone/Resources/Fonts/fps_images-hd.png"; sourceTree = ""; }; 52 | 3ED1A1AB15755F9C00600410 /* fps_images.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = fps_images.png; path = "../../external/cocos2d-iphone/Resources/Fonts/fps_images.png"; sourceTree = ""; }; 53 | /* End PBXFileReference section */ 54 | 55 | /* Begin PBXFrameworksBuildPhase section */ 56 | 3E8315B5157409C00086129D /* Frameworks */ = { 57 | isa = PBXFrameworksBuildPhase; 58 | buildActionMask = 2147483647; 59 | files = ( 60 | 3E83163D157411C10086129D /* libz.dylib in Frameworks */, 61 | 3E83163715740B7D0086129D /* libcocos2d.a in Frameworks */, 62 | 3E83163815740B7D0086129D /* libMonkSVG_iOS.a in Frameworks */, 63 | 3E83163915740B7D0086129D /* libMonkVG_iOS_OpenGL.a in Frameworks */, 64 | 3E83163215740B560086129D /* OpenGLES.framework in Frameworks */, 65 | 3E83163315740B560086129D /* QuartzCore.framework in Frameworks */, 66 | 3E8315C1157409C00086129D /* CoreGraphics.framework in Frameworks */, 67 | 3E8315E715740A910086129D /* libCCSVG.a in Frameworks */, 68 | 3E8315BD157409C00086129D /* UIKit.framework in Frameworks */, 69 | 3E8315BF157409C00086129D /* Foundation.framework in Frameworks */, 70 | 3E83172E157512560086129D /* boost.framework in Frameworks */, 71 | ); 72 | runOnlyForDeploymentPostprocessing = 0; 73 | }; 74 | /* End PBXFrameworksBuildPhase section */ 75 | 76 | /* Begin PBXGroup section */ 77 | 3E8315AD157409C00086129D = { 78 | isa = PBXGroup; 79 | children = ( 80 | 3E8315C2157409C00086129D /* CCSVGExample */, 81 | 3E8315BB157409C00086129D /* Frameworks */, 82 | 3E8315B9157409C00086129D /* Products */, 83 | ); 84 | sourceTree = ""; 85 | }; 86 | 3E8315B9157409C00086129D /* Products */ = { 87 | isa = PBXGroup; 88 | children = ( 89 | 3E8315B8157409C00086129D /* CCSVGExample.app */, 90 | ); 91 | name = Products; 92 | sourceTree = ""; 93 | }; 94 | 3E8315BB157409C00086129D /* Frameworks */ = { 95 | isa = PBXGroup; 96 | children = ( 97 | 3E83172D157512560086129D /* boost.framework */, 98 | 3E8315C0157409C00086129D /* CoreGraphics.framework */, 99 | 3E8315BE157409C00086129D /* Foundation.framework */, 100 | 3E8315E615740A910086129D /* libCCSVG.a */, 101 | 3E83163415740B7D0086129D /* libcocos2d.a */, 102 | 3E83163515740B7D0086129D /* libMonkSVG_iOS.a */, 103 | 3E83163615740B7D0086129D /* libMonkVG_iOS_OpenGL.a */, 104 | 3E83163C157411C10086129D /* libz.dylib */, 105 | 3E83162D15740B560086129D /* OpenGLES.framework */, 106 | 3E83162E15740B560086129D /* QuartzCore.framework */, 107 | 3E8315BC157409C00086129D /* UIKit.framework */, 108 | ); 109 | name = Frameworks; 110 | sourceTree = ""; 111 | }; 112 | 3E8315C2157409C00086129D /* CCSVGExample */ = { 113 | isa = PBXGroup; 114 | children = ( 115 | 3E83163F157411DC0086129D /* Classes */, 116 | 3E83163E157411D50086129D /* Resources */, 117 | 3E8315C3157409C00086129D /* Supporting Files */, 118 | ); 119 | path = CCSVGExample; 120 | sourceTree = ""; 121 | }; 122 | 3E8315C3157409C00086129D /* Supporting Files */ = { 123 | isa = PBXGroup; 124 | children = ( 125 | 3E8315C4157409C00086129D /* CCSVGExample-Info.plist */, 126 | 3E8315CA157409C00086129D /* CCSVGExample-Prefix.pch */, 127 | 3E8315C8157409C00086129D /* main.m */, 128 | ); 129 | name = "Supporting Files"; 130 | sourceTree = ""; 131 | }; 132 | 3E83163E157411D50086129D /* Resources */ = { 133 | isa = PBXGroup; 134 | children = ( 135 | 3ED1A1AA15755F9C00600410 /* fps_images-hd.png */, 136 | 3ED1A1AB15755F9C00600410 /* fps_images.png */, 137 | 3E831640157412060086129D /* bird_0001.svg */, 138 | 3E831642157412060086129D /* bird_0002.svg */, 139 | 3E8315C5157409C00086129D /* InfoPlist.strings */, 140 | ); 141 | name = Resources; 142 | sourceTree = ""; 143 | }; 144 | 3E83163F157411DC0086129D /* Classes */ = { 145 | isa = PBXGroup; 146 | children = ( 147 | 3E8315CB157409C00086129D /* AppDelegate.h */, 148 | 3E8315CC157409C00086129D /* AppDelegate.mm */, 149 | ); 150 | path = Classes; 151 | sourceTree = ""; 152 | }; 153 | /* End PBXGroup section */ 154 | 155 | /* Begin PBXNativeTarget section */ 156 | 3E8315B7157409C00086129D /* CCSVGExample */ = { 157 | isa = PBXNativeTarget; 158 | buildConfigurationList = 3E8315D9157409C10086129D /* Build configuration list for PBXNativeTarget "CCSVGExample" */; 159 | buildPhases = ( 160 | 3E8315B4157409C00086129D /* Sources */, 161 | 3E8315B5157409C00086129D /* Frameworks */, 162 | 3E8315B6157409C00086129D /* Resources */, 163 | ); 164 | buildRules = ( 165 | ); 166 | dependencies = ( 167 | ); 168 | name = CCSVGExample; 169 | productName = CCSVGExample; 170 | productReference = 3E8315B8157409C00086129D /* CCSVGExample.app */; 171 | productType = "com.apple.product-type.application"; 172 | }; 173 | /* End PBXNativeTarget section */ 174 | 175 | /* Begin PBXProject section */ 176 | 3E8315AF157409C00086129D /* Project object */ = { 177 | isa = PBXProject; 178 | attributes = { 179 | LastUpgradeCheck = 0430; 180 | }; 181 | buildConfigurationList = 3E8315B2157409C00086129D /* Build configuration list for PBXProject "CCSVGExample" */; 182 | compatibilityVersion = "Xcode 3.2"; 183 | developmentRegion = English; 184 | hasScannedForEncodings = 0; 185 | knownRegions = ( 186 | en, 187 | ); 188 | mainGroup = 3E8315AD157409C00086129D; 189 | productRefGroup = 3E8315B9157409C00086129D /* Products */; 190 | projectDirPath = ""; 191 | projectRoot = ""; 192 | targets = ( 193 | 3E8315B7157409C00086129D /* CCSVGExample */, 194 | ); 195 | }; 196 | /* End PBXProject section */ 197 | 198 | /* Begin PBXResourcesBuildPhase section */ 199 | 3E8315B6157409C00086129D /* Resources */ = { 200 | isa = PBXResourcesBuildPhase; 201 | buildActionMask = 2147483647; 202 | files = ( 203 | 3E8315C7157409C00086129D /* InfoPlist.strings in Resources */, 204 | 3E831644157412060086129D /* bird_0001.svg in Resources */, 205 | 3E831645157412060086129D /* bird_0002.svg in Resources */, 206 | 3ED1A1AC15755F9D00600410 /* fps_images-hd.png in Resources */, 207 | 3ED1A1AD15755F9D00600410 /* fps_images.png in Resources */, 208 | ); 209 | runOnlyForDeploymentPostprocessing = 0; 210 | }; 211 | /* End PBXResourcesBuildPhase section */ 212 | 213 | /* Begin PBXSourcesBuildPhase section */ 214 | 3E8315B4157409C00086129D /* Sources */ = { 215 | isa = PBXSourcesBuildPhase; 216 | buildActionMask = 2147483647; 217 | files = ( 218 | 3E8315C9157409C00086129D /* main.m in Sources */, 219 | 3E8315CD157409C00086129D /* AppDelegate.mm in Sources */, 220 | ); 221 | runOnlyForDeploymentPostprocessing = 0; 222 | }; 223 | /* End PBXSourcesBuildPhase section */ 224 | 225 | /* Begin PBXVariantGroup section */ 226 | 3E8315C5157409C00086129D /* InfoPlist.strings */ = { 227 | isa = PBXVariantGroup; 228 | children = ( 229 | 3E8315C6157409C00086129D /* en */, 230 | ); 231 | name = InfoPlist.strings; 232 | sourceTree = ""; 233 | }; 234 | 3E831640157412060086129D /* bird_0001.svg */ = { 235 | isa = PBXVariantGroup; 236 | children = ( 237 | 3E831641157412060086129D /* en */, 238 | ); 239 | name = bird_0001.svg; 240 | sourceTree = ""; 241 | }; 242 | 3E831642157412060086129D /* bird_0002.svg */ = { 243 | isa = PBXVariantGroup; 244 | children = ( 245 | 3E831643157412060086129D /* en */, 246 | ); 247 | name = bird_0002.svg; 248 | sourceTree = ""; 249 | }; 250 | /* End PBXVariantGroup section */ 251 | 252 | /* Begin XCBuildConfiguration section */ 253 | 3E8315D7157409C10086129D /* Debug */ = { 254 | isa = XCBuildConfiguration; 255 | buildSettings = { 256 | ALWAYS_SEARCH_USER_PATHS = NO; 257 | ARCHS = "$(ARCHS_STANDARD_32_BIT)"; 258 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer: Lutman Krogh (R9Y2C32V99)"; 259 | COPY_PHASE_STRIP = NO; 260 | FRAMEWORK_SEARCH_PATHS = ( 261 | "$(inherited)", 262 | "\"$(SRCROOT)/../external/MonkVG/Frameworks\"", 263 | ); 264 | GCC_C_LANGUAGE_STANDARD = gnu99; 265 | GCC_DYNAMIC_NO_PIC = NO; 266 | GCC_OPTIMIZATION_LEVEL = 0; 267 | GCC_PREPROCESSOR_DEFINITIONS = ( 268 | "DEBUG=1", 269 | "$(inherited)", 270 | ); 271 | GCC_SYMBOLS_PRIVATE_EXTERN = YES; 272 | GCC_VERSION = com.apple.compilers.llvm.clang.1_0; 273 | GCC_WARN_ABOUT_RETURN_TYPE = YES; 274 | GCC_WARN_UNINITIALIZED_AUTOS = YES; 275 | GCC_WARN_UNUSED_VARIABLE = YES; 276 | HEADER_SEARCH_PATHS = ( 277 | "$(inherited)", 278 | "\"$(SRCROOT)/../external/cocos2d-iphone/cocos2d\"/**", 279 | "\"$(TARGET_BUILD_DIR)/include\"", 280 | "\"$(OBJROOT)/UninstalledProducts/include\"", 281 | ); 282 | IPHONEOS_DEPLOYMENT_TARGET = 5.1; 283 | "PROVISIONING_PROFILE[sdk=iphoneos*]" = "FA35EADE-8044-4B26-9FA2-1929CD73B301"; 284 | SDKROOT = iphoneos; 285 | TARGETED_DEVICE_FAMILY = "1,2"; 286 | }; 287 | name = Debug; 288 | }; 289 | 3E8315D8157409C10086129D /* Release */ = { 290 | isa = XCBuildConfiguration; 291 | buildSettings = { 292 | ALWAYS_SEARCH_USER_PATHS = NO; 293 | ARCHS = "$(ARCHS_STANDARD_32_BIT)"; 294 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Distribution: zinc Roe Inc."; 295 | COPY_PHASE_STRIP = YES; 296 | FRAMEWORK_SEARCH_PATHS = ( 297 | "$(inherited)", 298 | "\"$(SRCROOT)/../external/MonkVG/Frameworks\"", 299 | ); 300 | GCC_C_LANGUAGE_STANDARD = gnu99; 301 | GCC_VERSION = com.apple.compilers.llvm.clang.1_0; 302 | GCC_WARN_ABOUT_RETURN_TYPE = YES; 303 | GCC_WARN_UNINITIALIZED_AUTOS = YES; 304 | GCC_WARN_UNUSED_VARIABLE = YES; 305 | HEADER_SEARCH_PATHS = ( 306 | "$(inherited)", 307 | "\"$(SRCROOT)/../external/cocos2d-iphone/cocos2d\"/**", 308 | "\"$(TARGET_BUILD_DIR)/include\"", 309 | "\"$(OBJROOT)/UninstalledProducts/include\"", 310 | ); 311 | IPHONEOS_DEPLOYMENT_TARGET = 5.1; 312 | OTHER_CFLAGS = "-DNS_BLOCK_ASSERTIONS=1"; 313 | "PROVISIONING_PROFILE[sdk=iphoneos*]" = "BBFF3A4B-EF79-4C28-B558-6CA64233D83A"; 314 | SDKROOT = iphoneos; 315 | TARGETED_DEVICE_FAMILY = "1,2"; 316 | VALIDATE_PRODUCT = YES; 317 | }; 318 | name = Release; 319 | }; 320 | 3E8315DA157409C10086129D /* Debug */ = { 321 | isa = XCBuildConfiguration; 322 | buildSettings = { 323 | FRAMEWORK_SEARCH_PATHS = ( 324 | "$(inherited)", 325 | "\"$(SRCROOT)/../external/MonkVG/Frameworks\"", 326 | ); 327 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 328 | GCC_PREFIX_HEADER = "CCSVGExample/CCSVGExample-Prefix.pch"; 329 | INFOPLIST_FILE = "CCSVGExample/CCSVGExample-Info.plist"; 330 | LIBRARY_SEARCH_PATHS = "$(inherited)"; 331 | PRODUCT_NAME = "$(TARGET_NAME)"; 332 | WRAPPER_EXTENSION = app; 333 | }; 334 | name = Debug; 335 | }; 336 | 3E8315DB157409C10086129D /* Release */ = { 337 | isa = XCBuildConfiguration; 338 | buildSettings = { 339 | FRAMEWORK_SEARCH_PATHS = ( 340 | "$(inherited)", 341 | "\"$(SRCROOT)/../external/MonkVG/Frameworks\"", 342 | ); 343 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 344 | GCC_PREFIX_HEADER = "CCSVGExample/CCSVGExample-Prefix.pch"; 345 | INFOPLIST_FILE = "CCSVGExample/CCSVGExample-Info.plist"; 346 | LIBRARY_SEARCH_PATHS = "$(inherited)"; 347 | PRODUCT_NAME = "$(TARGET_NAME)"; 348 | WRAPPER_EXTENSION = app; 349 | }; 350 | name = Release; 351 | }; 352 | /* End XCBuildConfiguration section */ 353 | 354 | /* Begin XCConfigurationList section */ 355 | 3E8315B2157409C00086129D /* Build configuration list for PBXProject "CCSVGExample" */ = { 356 | isa = XCConfigurationList; 357 | buildConfigurations = ( 358 | 3E8315D7157409C10086129D /* Debug */, 359 | 3E8315D8157409C10086129D /* Release */, 360 | ); 361 | defaultConfigurationIsVisible = 0; 362 | defaultConfigurationName = Release; 363 | }; 364 | 3E8315D9157409C10086129D /* Build configuration list for PBXNativeTarget "CCSVGExample" */ = { 365 | isa = XCConfigurationList; 366 | buildConfigurations = ( 367 | 3E8315DA157409C10086129D /* Debug */, 368 | 3E8315DB157409C10086129D /* Release */, 369 | ); 370 | defaultConfigurationIsVisible = 0; 371 | defaultConfigurationName = Release; 372 | }; 373 | /* End XCConfigurationList section */ 374 | }; 375 | rootObject = 3E8315AF157409C00086129D /* Project object */; 376 | } 377 | --------------------------------------------------------------------------------