summary refs log tree commit diff stats
path: root/libs/cocos2d/CCTMXObjectGroup.m
diff options
context:
space:
mode:
authorStarla Insigna <starla4444@gmail.com>2011-07-30 11:19:14 -0400
committerStarla Insigna <starla4444@gmail.com>2011-07-30 11:19:14 -0400
commit9cd57b731ab1c666d4a1cb725538fdc137763d12 (patch)
tree5bac45ae5157a1cb10c6e45500cbf72789917980 /libs/cocos2d/CCTMXObjectGroup.m
downloadcartcollect-9cd57b731ab1c666d4a1cb725538fdc137763d12.tar.gz
cartcollect-9cd57b731ab1c666d4a1cb725538fdc137763d12.tar.bz2
cartcollect-9cd57b731ab1c666d4a1cb725538fdc137763d12.zip
Initial commit (version 0.2.1)
Diffstat (limited to 'libs/cocos2d/CCTMXObjectGroup.m')
-rwxr-xr-xlibs/cocos2d/CCTMXObjectGroup.m86
1 files changed, 86 insertions, 0 deletions
diff --git a/libs/cocos2d/CCTMXObjectGroup.m b/libs/cocos2d/CCTMXObjectGroup.m new file mode 100755 index 0000000..648cda4 --- /dev/null +++ b/libs/cocos2d/CCTMXObjectGroup.m
@@ -0,0 +1,86 @@
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