Skip to content

Commit 6e1b096

Browse files
committed
Merge pull request #987 from osinoleg/develop
Bug fixes (#964 #973) - TileMap and Orientation fixes.
2 parents c5a9fd7 + 8bf075e commit 6e1b096

File tree

4 files changed

+57
-29
lines changed

4 files changed

+57
-29
lines changed

cocos2d-ios.xcodeproj/project.pbxproj

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -281,6 +281,7 @@
281281
D28A2E1B1954F68D00ADC03D /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D28A2E1A1954F68D00ADC03D /* QuartzCore.framework */; };
282282
D28A2E1D1954F7E000ADC03D /* OpenGLES.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D28A2E1C1954F7E000ADC03D /* OpenGLES.framework */; };
283283
D28A2E211954F85700ADC03D /* AVFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D28A2E201954F85700ADC03D /* AVFoundation.framework */; };
284+
D28B2E7A19CBA89A00DC6E08 /* CCEffectColorChannelOffset.m in Sources */ = {isa = PBXBuildFile; fileRef = 9DBCA31319B68BE400EFE96D /* CCEffectColorChannelOffset.m */; };
284285
D291DCC2195B2FA100278EC0 /* libObjectiveChipmunk-iPhone.a in Frameworks */ = {isa = PBXBuildFile; fileRef = B759E52D1880C66900E8166C /* libObjectiveChipmunk-iPhone.a */; };
285286
D299CE7A19C2910B00519CBB /* CCEffectDFInnerGlow.h in Headers */ = {isa = PBXBuildFile; fileRef = D299CE7819C2910B00519CBB /* CCEffectDFInnerGlow.h */; };
286287
D299CE7B19C2910B00519CBB /* CCEffectDFInnerGlow.h in Headers */ = {isa = PBXBuildFile; fileRef = D299CE7819C2910B00519CBB /* CCEffectDFInnerGlow.h */; };
@@ -309,7 +310,6 @@
309310
D2DDB0A719805E8400233D80 /* CCMatrix3.m in Sources */ = {isa = PBXBuildFile; fileRef = D2DDB09219805E8400233D80 /* CCMatrix3.m */; };
310311
D2DDB0A819805E8400233D80 /* CCMatrix3.m in Sources */ = {isa = PBXBuildFile; fileRef = D2DDB09219805E8400233D80 /* CCMatrix3.m */; };
311312
D2EC6039199D9F82001A15E9 /* CCRendererGLSupport.m in Sources */ = {isa = PBXBuildFile; fileRef = D36DFA2719996EC500DEC135 /* CCRendererGLSupport.m */; };
312-
D2F78CC81999AB6E00229357 /* CCEffectDropShadow.h in Headers */ = {isa = PBXBuildFile; fileRef = D2F78CC71999AB6E00229357 /* CCEffectDropShadow.h */; };
313313
D2FEB611194F6C9E00FC0574 /* CCBLocalizationManager.h in Headers */ = {isa = PBXBuildFile; fileRef = B7D273041822F4AA0054849B /* CCBLocalizationManager.h */; };
314314
D2FEB612194F6C9E00FC0574 /* CCAction.h in Headers */ = {isa = PBXBuildFile; fileRef = 5018F2520DFDEAFF00C013A5 /* CCAction.h */; };
315315
D2FEB613194F6C9E00FC0574 /* CCNode.h in Headers */ = {isa = PBXBuildFile; fileRef = 5018F2540DFDEAFF00C013A5 /* CCNode.h */; };
@@ -599,6 +599,13 @@
599599
remoteGlobalIDString = D309B21217EFE2EF00AA52C8;
600600
remoteInfo = "ObjectiveChipmunk-iPhone";
601601
};
602+
D28B2E7D19CBA89A00DC6E08 /* PBXContainerItemProxy */ = {
603+
isa = PBXContainerItemProxy;
604+
containerPortal = FC39961319C3B92F00C93E5E /* ObjectAL.xcodeproj */;
605+
proxyType = 2;
606+
remoteGlobalIDString = D369B53219C8E73C00BA46EA;
607+
remoteInfo = "ObjectAL (Mac)";
608+
};
602609
D2FEB60F194F6C9E00FC0574 /* PBXContainerItemProxy */ = {
603610
isa = PBXContainerItemProxy;
604611
containerPortal = B759E5281880C66900E8166C /* Chipmunk7-ios.xcodeproj */;
@@ -613,13 +620,6 @@
613620
remoteGlobalIDString = CBBAB312171D0B84009B955F;
614621
remoteInfo = "ObjectAL (iOS)";
615622
};
616-
FC39961C19C3B92F00C93E5E /* PBXContainerItemProxy */ = {
617-
isa = PBXContainerItemProxy;
618-
containerPortal = FC39961319C3B92F00C93E5E /* ObjectAL.xcodeproj */;
619-
proxyType = 2;
620-
remoteGlobalIDString = CBBAB33D171D0BC4009B955F;
621-
remoteInfo = "ObjectAL (OSX)";
622-
};
623623
FC39961E19C3B92F00C93E5E /* PBXContainerItemProxy */ = {
624624
isa = PBXContainerItemProxy;
625625
containerPortal = FC39961319C3B92F00C93E5E /* ObjectAL.xcodeproj */;
@@ -1707,8 +1707,8 @@
17071707
isa = PBXGroup;
17081708
children = (
17091709
FC39961B19C3B92F00C93E5E /* libObjectAL.a */,
1710-
FC39961D19C3B92F00C93E5E /* ObjectAL.framework */,
17111710
FC39961F19C3B92F00C93E5E /* libObjectAL (Android).a */,
1711+
D28B2E7E19CBA89A00DC6E08 /* libObjectAL (Mac).a */,
17121712
);
17131713
name = Products;
17141714
sourceTree = "<group>";
@@ -2131,18 +2131,18 @@
21312131
remoteRef = B759E52C1880C66900E8166C /* PBXContainerItemProxy */;
21322132
sourceTree = BUILT_PRODUCTS_DIR;
21332133
};
2134-
FC39961B19C3B92F00C93E5E /* libObjectAL.a */ = {
2134+
D28B2E7E19CBA89A00DC6E08 /* libObjectAL (Mac).a */ = {
21352135
isa = PBXReferenceProxy;
21362136
fileType = archive.ar;
2137-
path = libObjectAL.a;
2138-
remoteRef = FC39961A19C3B92F00C93E5E /* PBXContainerItemProxy */;
2137+
path = "libObjectAL (Mac).a";
2138+
remoteRef = D28B2E7D19CBA89A00DC6E08 /* PBXContainerItemProxy */;
21392139
sourceTree = BUILT_PRODUCTS_DIR;
21402140
};
2141-
FC39961D19C3B92F00C93E5E /* ObjectAL.framework */ = {
2141+
FC39961B19C3B92F00C93E5E /* libObjectAL.a */ = {
21422142
isa = PBXReferenceProxy;
2143-
fileType = wrapper.framework;
2144-
path = ObjectAL.framework;
2145-
remoteRef = FC39961C19C3B92F00C93E5E /* PBXContainerItemProxy */;
2143+
fileType = archive.ar;
2144+
path = libObjectAL.a;
2145+
remoteRef = FC39961A19C3B92F00C93E5E /* PBXContainerItemProxy */;
21462146
sourceTree = BUILT_PRODUCTS_DIR;
21472147
};
21482148
FC39961F19C3B92F00C93E5E /* libObjectAL (Android).a */ = {
@@ -2375,6 +2375,7 @@
23752375
D2FEB6E7194F6C9E00FC0574 /* ZipUtils.m in Sources */,
23762376
D2FEB6EA194F6C9E00FC0574 /* CCEffectStack.m in Sources */,
23772377
D2FEB6EC194F6C9E00FC0574 /* CCRenderTexture.m in Sources */,
2378+
D28B2E7A19CBA89A00DC6E08 /* CCEffectColorChannelOffset.m in Sources */,
23782379
D2FEB6ED194F6C9E00FC0574 /* CCMotionStreak.m in Sources */,
23792380
D2FEB6EE194F6C9E00FC0574 /* CCSpriteFrame.m in Sources */,
23802381
D2FEB6EF194F6C9E00FC0574 /* CCSpriteFrameCache.m in Sources */,

cocos2d-tests-ios.xcodeproj/project.pbxproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@
6666
B7EE69811818760700B983FE /* CCSprite9SliceTest.m in Sources */ = {isa = PBXBuildFile; fileRef = B7EE69801818760700B983FE /* CCSprite9SliceTest.m */; };
6767
B7EE69CF1819D82300B983FE /* CCLayoutTest.m in Sources */ = {isa = PBXBuildFile; fileRef = B7EE69CE1819D82300B983FE /* CCLayoutTest.m */; };
6868
B7EE6A28181B075E00B983FE /* CCSliderTest.m in Sources */ = {isa = PBXBuildFile; fileRef = B7EE6A27181B075E00B983FE /* CCSliderTest.m */; };
69+
D23CD73119CB881200C7EB14 /* CCShaders.metal in Resources */ = {isa = PBXBuildFile; fileRef = D3C1281C199D43E0005D2119 /* CCShaders.metal */; };
6970
D24FAEED198014C80043E27D /* GLKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D34CD3C118ABEE9C00D8E537 /* GLKit.framework */; };
7071
D28A2E181954F68200ADC03D /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D28A2E171954F68200ADC03D /* UIKit.framework */; };
7172
D28A2E1F1954F7E900ADC03D /* OpenGLES.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D28A2E1E1954F7E900ADC03D /* OpenGLES.framework */; };
@@ -78,7 +79,6 @@
7879
D34CD3C518ABF4AA00D8E537 /* CCRendererTests.m in Sources */ = {isa = PBXBuildFile; fileRef = D34CD3C418ABF4AA00D8E537 /* CCRendererTests.m */; };
7980
D3870C6018B440150033D885 /* SpritePerformanceTest.m in Sources */ = {isa = PBXBuildFile; fileRef = D3870C5F18B440150033D885 /* SpritePerformanceTest.m */; };
8081
D3B2A7E5187DD60B00406C5A /* CCBMFontTest.m in Sources */ = {isa = PBXBuildFile; fileRef = D3B2A7E4187DD60B00406C5A /* CCBMFontTest.m */; };
81-
D3C1281D199D43E0005D2119 /* CCShaders.metal in Sources */ = {isa = PBXBuildFile; fileRef = D3C1281C199D43E0005D2119 /* CCShaders.metal */; };
8282
D3C9C867188078B900C58900 /* CCSchedulerTest.m in Sources */ = {isa = PBXBuildFile; fileRef = D3C9C866188078B900C58900 /* CCSchedulerTest.m */; };
8383
D3D6CF5F18BD5F0500A51531 /* CCRendererTest.m in Sources */ = {isa = PBXBuildFile; fileRef = D3D6CF5E18BD5F0500A51531 /* CCRendererTest.m */; };
8484
D4AFE9131977100000261299 /* A Damn Mess.ttf in Resources */ = {isa = PBXBuildFile; fileRef = D4AFE8D81977100000261299 /* A Damn Mess.ttf */; };
@@ -867,6 +867,7 @@
867867
D4AFE9371977100000261299 /* konqa32-hd.png in Resources */,
868868
D4AFE9161977100000261299 /* arial-unicode-26.fnt in Resources */,
869869
B7E2621417E7D34D007067F0 /* Icon-Small.png in Resources */,
870+
D23CD73119CB881200C7EB14 /* CCShaders.metal in Resources */,
870871
D4AFE9361977100000261299 /* konqa32-hd.fnt in Resources */,
871872
D4AFE93C1977100000261299 /* larabie-16.plist in Resources */,
872873
D4AFE93A1977100000261299 /* larabie-16-hd.plist in Resources */,
@@ -944,7 +945,6 @@
944945
D3870C6018B440150033D885 /* SpritePerformanceTest.m in Sources */,
945946
B71B088217EA5B6A0082EBC0 /* CCScrollViewTest.m in Sources */,
946947
B7EE697918186D5200B983FE /* CCTextFieldTest.m in Sources */,
947-
D3C1281D199D43E0005D2119 /* CCShaders.metal in Sources */,
948948
B7E2620017E7D321007067F0 /* AppDelegate.m in Sources */,
949949
0E28FE1A197FCE4500F78989 /* CCCacheTest.m in Sources */,
950950
B77060AB1832E3310043CC67 /* CCTextureCacheTest.m in Sources */,

cocos2d/CCTMXXMLParser.m

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -192,16 +192,16 @@ - (void) dealloc
192192

193193
- (void) parseXMLData:(NSData*)data
194194
{
195-
NSXMLParser *parser = [[NSXMLParser alloc] initWithData:data];
196-
197-
// we'll do the parsing
198-
[parser setDelegate:self];
199-
[parser setShouldProcessNamespaces:NO];
200-
[parser setShouldReportNamespacePrefixes:NO];
201-
[parser setShouldResolveExternalEntities:NO];
202-
[parser parse];
203-
204-
NSAssert1( ![parser parserError], @"Error parsing TMX data: %@.", [NSString stringWithCharacters:[data bytes] length:[data length]] );
195+
NSXMLParser *parser = [[NSXMLParser alloc] initWithData:data];
196+
197+
// we'll do the parsing
198+
[parser setDelegate:self];
199+
[parser setShouldProcessNamespaces:NO];
200+
[parser setShouldReportNamespacePrefixes:NO];
201+
[parser setShouldResolveExternalEntities:NO];
202+
[parser parse];
203+
204+
NSAssert1( ![parser parserError], @"Error parsing TMX data: %@.", [NSString stringWithCharacters:[data bytes] length:[data length]] );
205205
}
206206

207207
- (void) parseXMLString:(NSString *)xmlString
@@ -252,7 +252,13 @@ -(void)parser:(NSXMLParser *)parser didStartElement:(NSString *)elementName name
252252

253253
_currentFirstGID = [[attributeDict objectForKey:@"firstgid"] intValue];
254254

255-
[self parseXMLFile:externalTilesetFilename];
255+
// since the xml parser is not reentrant, we need to invoke each child xml parser in its own queue
256+
dispatch_queue_t reentrantAvoidanceQueue = dispatch_queue_create("xmlParserSafeQueue", DISPATCH_QUEUE_SERIAL);
257+
dispatch_async(reentrantAvoidanceQueue, ^{
258+
[self parseXMLFile:externalTilesetFilename];
259+
});
260+
dispatch_sync(reentrantAvoidanceQueue, ^{ });
261+
256262
} else {
257263
CCTiledMapTilesetInfo *tileset = [CCTiledMapTilesetInfo new];
258264
tileset.name = [attributeDict objectForKey:@"name"];

cocos2d/Platforms/iOS/CCAppDelegate.m

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,27 @@ - (void) setupCocos2dWithOptions:(NSDictionary*)config
261261

262262
// make main window visible
263263
[window_ makeKeyAndVisible];
264+
265+
[self forceOrientation];
266+
}
267+
268+
// iOS8 hack around orientation bug
269+
-(void)forceOrientation
270+
{
271+
#if __CC_PLATFORM_IOS && defined(__IPHONE_8_0) && __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_8_0
272+
if([navController_.screenOrientation isEqual:CCScreenOrientationAll])
273+
{
274+
[[UIApplication sharedApplication] setStatusBarOrientation:UIInterfaceOrientationUnknown];
275+
}
276+
else if([navController_.screenOrientation isEqual:CCScreenOrientationPortrait])
277+
{
278+
[[UIApplication sharedApplication] setStatusBarOrientation:UIDeviceOrientationPortrait | UIDeviceOrientationPortraitUpsideDown];
279+
}
280+
else
281+
{
282+
[[UIApplication sharedApplication] setStatusBarOrientation:UIDeviceOrientationLandscapeLeft | UIDeviceOrientationLandscapeRight];
283+
}
284+
#endif
264285
}
265286

266287
// getting a call, pause the game

0 commit comments

Comments
 (0)