Skip to content

Commit 3ded029

Browse files
committed
Merge branch 'develop' into metal-hacking
Conflicts: cocos2d-ios.xcodeproj/project.pbxproj cocos2d-ui/CCBReader/CCBReader.m cocos2d/CCRenderTexture.m cocos2d/cocos2d.h
2 parents 67384fc + c5a9fd7 commit 3ded029

File tree

104 files changed

+1390
-20387
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

104 files changed

+1390
-20387
lines changed

.gitmodules

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,7 @@
11
[submodule "external/Chipmunk"]
22
path = external/Chipmunk
33
url=https://github.com/slembcke/Chipmunk2D.git
4-
[submodule "external/ogg"]
5-
path = external/ogg
6-
url=https://github.com/spritebuilder/ogg.git
7-
branch = apportable
8-
[submodule "external/tremor"]
9-
path = external/tremor
10-
url=https://github.com/spritebuilder/tremor.git
4+
[submodule "external/ObjectAL"]
5+
path = external/ObjectAL
6+
url = https://github.com/spritebuilder/ObjectAL-for-Cocos2D.git
117
branch = apportable

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
3.3.0-alpha.1
1+
3.3.0-alpha.1

cocos2d-ios.xcodeproj/project.pbxproj

Lines changed: 92 additions & 452 deletions
Large diffs are not rendered by default.

cocos2d-osx.xcodeproj/project.pbxproj

Lines changed: 134 additions & 348 deletions
Large diffs are not rendered by default.

cocos2d-tests-osx.xcodeproj/project.pbxproj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@
101101
B7EE698518187BC900B983FE /* CCSprite9SliceTest.m in Sources */ = {isa = PBXBuildFile; fileRef = B7EE698418187BC900B983FE /* CCSprite9SliceTest.m */; };
102102
B7EE69F01819EB0E00B983FE /* CCLayoutTest.m in Sources */ = {isa = PBXBuildFile; fileRef = B7EE69EF1819EB0E00B983FE /* CCLayoutTest.m */; };
103103
B7EE6A30181B285700B983FE /* CCSliderTest.m in Sources */ = {isa = PBXBuildFile; fileRef = B7EE6A2F181B285700B983FE /* CCSliderTest.m */; };
104+
D3758C1119C8EBDE00B4E13A /* Music in Resources */ = {isa = PBXBuildFile; fileRef = D3758C1019C8EBDE00B4E13A /* Music */; };
104105
D389410E18639CC900725CFC /* CCPhysicsTest.m in Sources */ = {isa = PBXBuildFile; fileRef = D389410D18639CC900725CFC /* CCPhysicsTest.m */; };
105106
D3AD532618C85006005B6CF3 /* GLKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D3AD532518C85006005B6CF3 /* GLKit.framework */; };
106107
D3AD532E18C856AC005B6CF3 /* CCBMFontTest.m in Sources */ = {isa = PBXBuildFile; fileRef = D3AD532818C856AC005B6CF3 /* CCBMFontTest.m */; };
@@ -236,6 +237,7 @@
236237
B7EE698418187BC900B983FE /* CCSprite9SliceTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CCSprite9SliceTest.m; path = "cocos2d-ui-tests/tests/CCSprite9SliceTest.m"; sourceTree = SOURCE_ROOT; };
237238
B7EE69EF1819EB0E00B983FE /* CCLayoutTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CCLayoutTest.m; path = "cocos2d-ui-tests/tests/CCLayoutTest.m"; sourceTree = SOURCE_ROOT; };
238239
B7EE6A2F181B285700B983FE /* CCSliderTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CCSliderTest.m; path = "cocos2d-ui-tests/tests/CCSliderTest.m"; sourceTree = SOURCE_ROOT; };
240+
D3758C1019C8EBDE00B4E13A /* Music */ = {isa = PBXFileReference; lastKnownFileType = folder; name = Music; path = Resources/Music; sourceTree = SOURCE_ROOT; };
239241
D389410D18639CC900725CFC /* CCPhysicsTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CCPhysicsTest.m; path = "cocos2d-ui-tests/tests/CCPhysicsTest.m"; sourceTree = SOURCE_ROOT; };
240242
D389412F18639E4500725CFC /* libObjectiveChipmunk.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libObjectiveChipmunk.a; path = DerivedData/cocos2d/Build/Products/Debug/libObjectiveChipmunk.a; sourceTree = "<group>"; };
241243
D389413118639E5000725CFC /* libChipmunk.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libChipmunk.a; path = external/Chipmunk/xcode/build/Debug/libChipmunk.a; sourceTree = "<group>"; };
@@ -336,6 +338,7 @@
336338
75FCA70E185F89A0006E7468 /* Test Resources */ = {
337339
isa = PBXGroup;
338340
children = (
341+
D3758C1019C8EBDE00B4E13A /* Music */,
339342
75FCA70A185F89A0006E7468 /* Sounds */,
340343
75FCA70B185F89A0006E7468 /* Particles */,
341344
75FCA70C185F89A0006E7468 /* TileMaps */,
@@ -586,6 +589,7 @@
586589
57E145A11975E3230065F142 /* larabie-16.plist in Resources */,
587590
57E145821975E3230065F142 /* bitmapFontTest2.fnt in Resources */,
588591
57E145931975E3230065F142 /* fps_images.plist in Resources */,
592+
D3758C1119C8EBDE00B4E13A /* Music in Resources */,
589593
57E145A31975E3230065F142 /* markerFelt-hd.fnt in Resources */,
590594
57E145941975E3230065F142 /* fps_images.png in Resources */,
591595
57E145801975E3230065F142 /* bitmapFontTest.fnt in Resources */,

cocos2d-ui-tests/tests/CCBMFontTest.m

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
static NSString *TEST_STRINGS[] = {
1313
@"ABCDEFGHIJKLM\nNOPQRSTUVWXYZ",
1414
@"abcdefghijklm\nnopqrstuvwxyz",
15+
@"first line\u2028second line",
1516
@",.?!;:'\"",
1617
@"()[]{}<>\\|/\n",
1718
@"@#$%^&*+-=_",

cocos2d-ui-tests/tests/CCEffectsTest.m

Lines changed: 202 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ @implementation CCEffectsTest {
1212
#if CC_EFFECTS_EXPERIMENTAL
1313
CCEffectDistanceField* _distanceFieldEffect;
1414
CCEffectDFOutline* _outlineEffect;
15+
CCEffectDFInnerGlow* _innerGlowEffect;
1516
#endif
1617
}
1718

@@ -29,6 +30,56 @@ -(id)init
2930

3031
#if CC_EFFECTS_EXPERIMENTAL
3132

33+
-(void)setupDFInnerGlowTest
34+
{
35+
self.subTitle = @"Distance Field Inner Glow Test";
36+
37+
CCSprite *environment = [CCSprite spriteWithImageNamed:@"Images/MountainPanorama.jpg"];
38+
environment.positionType = CCPositionTypeNormalized;
39+
environment.anchorPoint = ccp(0.5, 0.5);
40+
environment.position = ccp(0.5f, 0.5f);
41+
42+
CCTexture* texture = [[CCTextureCache sharedTextureCache] addImage:@"Images/output.png"];
43+
44+
CCColor* fillColor = [CCColor colorWithRed:0.0 green:1.0 blue:0.0 alpha:0.5];
45+
_innerGlowEffect = [CCEffectDFInnerGlow effectWithGlowColor:[CCColor redColor] fillColor:fillColor glowWidth:2 fieldScale:32 distanceField:texture];
46+
47+
CCSprite *dfSprite = [CCSprite spriteWithImageNamed:@"Images/df_sprite.png"];
48+
dfSprite.position = ccp(0.5, 0.5);
49+
dfSprite.positionType = CCPositionTypeNormalized;
50+
dfSprite.effect = _innerGlowEffect;
51+
dfSprite.scale = 1.0f;
52+
53+
CCSpriteFrame* background = [CCSpriteFrame frameWithImageNamed:@"Tests/slider-background.png"];
54+
CCSpriteFrame* backgroundHilite = [CCSpriteFrame frameWithImageNamed:@"Tests/slider-background-hilite.png"];
55+
CCSpriteFrame* handle = [CCSpriteFrame frameWithImageNamed:@"Tests/slider-handle.png"];
56+
57+
CCSlider* slider = [[CCSlider alloc] initWithBackground:background andHandleImage:handle];
58+
[slider setBackgroundSpriteFrame:backgroundHilite forState:CCControlStateHighlighted];
59+
slider.positionType = CCPositionTypeNormalized;
60+
slider.position = ccp(0.1f, 0.5f);
61+
slider.sliderValue = 0.3;
62+
slider.preferredSizeType = CCSizeTypeMake(CCSizeUnitNormalized, CCSizeUnitUIPoints);
63+
slider.preferredSize = CGSizeMake(0.5f, 10);
64+
slider.rotation = 90;
65+
slider.anchorPoint = ccp(0.5f, 0.5f);
66+
slider.scale = 0.8;
67+
68+
[slider setTarget:self selector:@selector(innerGlowWidthChanged:)];
69+
70+
[self.contentNode addChild:environment];
71+
[self.contentNode addChild:slider];
72+
[self.contentNode addChild:dfSprite];
73+
}
74+
75+
- (void)innerGlowWidthChanged:(id)sender
76+
{
77+
const int innerGloWMax = 6;
78+
CCSlider* slider = sender;
79+
_innerGlowEffect.glowWidth = slider.sliderValue * innerGloWMax;
80+
}
81+
82+
3283
-(void)setupDFOutlineEffectTest
3384
{
3485
self.subTitle = @"Distance Field Outline Test";
@@ -40,8 +91,8 @@ -(void)setupDFOutlineEffectTest
4091

4192
CCTexture* texture = [[CCTextureCache sharedTextureCache] addImage:@"Images/output.png"];
4293

43-
CCColor* fillColor = [CCColor colorWithRed:0.0 green:0.0 blue:0.0 alpha:0.0];
44-
_outlineEffect = [CCEffectDFOutline effectWithOutlineColor:[CCColor redColor] fillColor:fillColor outlineWidth:3 fieldScale:32 distanceField:texture];
94+
CCColor* fillColor = [CCColor colorWithRed:0.0 green:0.0 blue:1.0 alpha:0.0];
95+
_outlineEffect = [CCEffectDFOutline effectWithOutlineColor:[CCColor redColor] fillColor:fillColor outlineWidth:1 fieldScale:32 distanceField:texture];
4596

4697
CCSprite *dfSprite = [CCSprite spriteWithImageNamed:@"Images/df_sprite.png"];
4798
dfSprite.position = ccp(0.5, 0.5);
@@ -57,12 +108,12 @@ -(void)setupDFOutlineEffectTest
57108
[slider setBackgroundSpriteFrame:backgroundHilite forState:CCControlStateHighlighted];
58109
slider.positionType = CCPositionTypeNormalized;
59110
slider.position = ccp(0.1f, 0.5f);
60-
61111
slider.preferredSizeType = CCSizeTypeMake(CCSizeUnitNormalized, CCSizeUnitUIPoints);
62112
slider.preferredSize = CGSizeMake(0.5f, 10);
63113
slider.rotation = 90;
64114
slider.anchorPoint = ccp(0.5f, 0.5f);
65115
slider.scale = 0.8;
116+
slider.sliderValue = 0.1;
66117

67118
[slider setTarget:self selector:@selector(outlineWidthChagne:)];
68119

@@ -200,6 +251,151 @@ - (void)enableOutline:(id)sender
200251

201252
#endif
202253

254+
-(void)setupPaddingEffectTest
255+
{
256+
self.subTitle = @"Effect Padding Test";
257+
258+
{
259+
CCSprite *sprite = [CCSprite spriteWithImageNamed:@"Images/particles.png"];
260+
sprite.positionType = CCPositionTypeNormalized;
261+
sprite.position = ccp(0.75f, 0.8f);
262+
263+
[self.contentNode addChild:sprite];
264+
265+
CCLabelTTF *title = [CCLabelTTF labelWithString:@"Original Sprite" fontName:@"HelveticaNeue-Light" fontSize:14 * [CCDirector sharedDirector].UIScaleFactor];
266+
title.color = [CCColor whiteColor];
267+
title.positionType = CCPositionTypeNormalized;
268+
title.position = ccp(0.25f, 0.8f);
269+
title.horizontalAlignment = CCTextAlignmentCenter;
270+
271+
[self.contentNode addChild:title];
272+
}
273+
274+
{
275+
CCSprite *sprite = [CCSprite spriteWithImageNamed:@"Images/particles.png"];
276+
sprite.positionType = CCPositionTypeNormalized;
277+
sprite.position = ccp(0.75f, 0.65f);
278+
279+
CCEffectColorChannelOffset *offset = [CCEffectColorChannelOffset effectWithRedOffset:GLKVector2Make(5.0f, 0.0f) greenOffset:GLKVector2Make(-4.0f, 4.0f) blueOffset:GLKVector2Make(-4.0f, -4.0f)];
280+
sprite.effect = offset;
281+
282+
[self.contentNode addChild:sprite];
283+
284+
CCLabelTTF *title = [CCLabelTTF labelWithString:@"Color channel offset without padding" fontName:@"HelveticaNeue-Light" fontSize:14 * [CCDirector sharedDirector].UIScaleFactor];
285+
title.color = [CCColor whiteColor];
286+
title.positionType = CCPositionTypeNormalized;
287+
title.position = ccp(0.25f, 0.65f);
288+
title.horizontalAlignment = CCTextAlignmentCenter;
289+
290+
[self.contentNode addChild:title];
291+
}
292+
293+
{
294+
CCSprite *sprite = [CCSprite spriteWithImageNamed:@"Images/particles.png"];
295+
sprite.positionType = CCPositionTypeNormalized;
296+
sprite.position = ccp(0.75f, 0.5f);
297+
298+
CCEffectColorChannelOffset *offset = [CCEffectColorChannelOffset effectWithRedOffset:GLKVector2Make(5.0f, 0.0f) greenOffset:GLKVector2Make(-4.0f, 4.0f) blueOffset:GLKVector2Make(-4.0f, -4.0f)];
299+
offset.padding = CGSizeMake(5.0f, 5.0f);
300+
sprite.effect = offset;
301+
302+
[self.contentNode addChild:sprite];
303+
304+
CCLabelTTF *title = [CCLabelTTF labelWithString:@"Color channel offset with padding" fontName:@"HelveticaNeue-Light" fontSize:14 * [CCDirector sharedDirector].UIScaleFactor];
305+
title.color = [CCColor whiteColor];
306+
title.positionType = CCPositionTypeNormalized;
307+
title.position = ccp(0.25f, 0.5f);
308+
title.horizontalAlignment = CCTextAlignmentCenter;
309+
310+
[self.contentNode addChild:title];
311+
}
312+
313+
{
314+
CCSprite *sprite = [CCSprite spriteWithImageNamed:@"Images/particles.png"];
315+
sprite.positionType = CCPositionTypeNormalized;
316+
sprite.position = ccp(0.75f, 0.35f);
317+
318+
CCEffectColorChannelOffset *offset = [CCEffectColorChannelOffset effectWithRedOffset:GLKVector2Make(5.0f, 0.0f) greenOffset:GLKVector2Make(-4.0f, 4.0f) blueOffset:GLKVector2Make(-4.0f, -4.0f)];
319+
offset.padding = CGSizeMake(5.0f, 5.0f);
320+
CCEffectHue *hue = [CCEffectHue effectWithHue:60.0f];
321+
sprite.effect = [CCEffectStack effectWithArray:@[offset, hue]];
322+
323+
[self.contentNode addChild:sprite];
324+
325+
CCLabelTTF *title = [CCLabelTTF labelWithString:@"Padded effect stack (offset then hue)" fontName:@"HelveticaNeue-Light" fontSize:14 * [CCDirector sharedDirector].UIScaleFactor];
326+
title.color = [CCColor whiteColor];
327+
title.positionType = CCPositionTypeNormalized;
328+
title.position = ccp(0.25f, 0.35f);
329+
title.horizontalAlignment = CCTextAlignmentCenter;
330+
331+
[self.contentNode addChild:title];
332+
}
333+
334+
{
335+
CCSprite *sprite = [CCSprite spriteWithImageNamed:@"Images/particles.png"];
336+
sprite.positionType = CCPositionTypeNormalized;
337+
sprite.position = ccp(0.75f, 0.2f);
338+
339+
CCEffectColorChannelOffset *offset = [CCEffectColorChannelOffset effectWithRedOffset:GLKVector2Make(5.0f, 0.0f) greenOffset:GLKVector2Make(-4.0f, 4.0f) blueOffset:GLKVector2Make(-4.0f, -4.0f)];
340+
offset.padding = CGSizeMake(5.0f, 5.0f);
341+
CCEffectHue *hue = [CCEffectHue effectWithHue:60.0f];
342+
sprite.effect = [CCEffectStack effectWithArray:@[hue, offset]];
343+
344+
[self.contentNode addChild:sprite];
345+
346+
CCLabelTTF *title = [CCLabelTTF labelWithString:@"Padded efect stack (hue then offset)" fontName:@"HelveticaNeue-Light" fontSize:14 * [CCDirector sharedDirector].UIScaleFactor];
347+
title.color = [CCColor whiteColor];
348+
title.positionType = CCPositionTypeNormalized;
349+
title.position = ccp(0.25f, 0.2f);
350+
title.horizontalAlignment = CCTextAlignmentCenter;
351+
352+
[self.contentNode addChild:title];
353+
}
354+
}
355+
356+
-(void)setupColorChannelOffsetTest
357+
{
358+
self.subTitle = @"Color Channel Offset Effect Test";
359+
360+
CCEffectColorChannelOffset *effect = [CCEffectColorChannelOffset effectWithRedOffset:GLKVector2Make(0.0f, 0.0f) greenOffset:GLKVector2Make(0.0f, 0.0f) blueOffset:GLKVector2Make(0.0f, 0.0f)];
361+
effect.padding = CGSizeMake(5.0f, 5.0f);
362+
363+
CCSprite *sprite = [CCSprite spriteWithImageNamed:@"Images/particles.png"];
364+
sprite.scale = 1.0f;
365+
sprite.positionType = CCPositionTypeNormalized;
366+
sprite.position = ccp(0.5f, 0.5f);
367+
sprite.effect = effect;
368+
369+
[self.contentNode addChild:sprite];
370+
371+
const float thetaStep = CC_DEGREES_TO_RADIANS(10.0f);
372+
__block float redTheta = CC_DEGREES_TO_RADIANS(0.0f);
373+
__block float greenTheta = CC_DEGREES_TO_RADIANS(120.0f);
374+
__block float blueTheta = CC_DEGREES_TO_RADIANS(240.0f);
375+
void (^updateBlock)() = ^{
376+
377+
float redRadius = 3.0f;
378+
effect.redOffset = GLKVector2Make(redRadius * cosf(redTheta), redRadius * sinf(redTheta));
379+
380+
float greenRadius = 3.0f;
381+
effect.greenOffset = GLKVector2Make(greenRadius * cosf(greenTheta), greenRadius * sinf(greenTheta));
382+
383+
float blueRadius = 3.0f;
384+
effect.blueOffset = GLKVector2Make(blueRadius * cosf(blueTheta), blueRadius * sinf(blueTheta));
385+
386+
redTheta += thetaStep;
387+
greenTheta += thetaStep;
388+
blueTheta += thetaStep;
389+
};
390+
updateBlock();
391+
392+
[sprite runAction:[CCActionRepeatForever actionWithAction:[CCActionSequence actions:
393+
[CCActionDelay actionWithDuration:0.1f],
394+
[CCActionCallBlock actionWithBlock:updateBlock],
395+
nil
396+
]]];
397+
}
398+
203399
#pragma mark DropShadow
204400

205401
-(void)setupDropShadowEffectTest
@@ -608,13 +804,14 @@ -(void)setupBloomEffectTest
608804
const int steps = 5;
609805
for (int i = 0; i < steps; i++)
610806
{
611-
CCSprite *sampleSprite3 = [CCSprite spriteWithImageNamed:@"Images/grossini_dance_08.png"];
807+
CCSprite *sampleSprite3 = [CCSprite spriteWithImageNamed:@"Images/f1.png"];
612808
sampleSprite3.anchorPoint = ccp(0.5, 0.5);
613809
sampleSprite3.position = ccp(0.1f + i * (0.8f / (steps - 1)), 0.2f);
614810
sampleSprite3.positionType = CCPositionTypeNormalized;
615811

616812
// Blend glow maps test
617-
CCEffectBloom* glowEffect3 = [CCEffectBloom effectWithBlurRadius:3 intensity:1.0f luminanceThreshold:1.0f - ((float)i/(float)(steps-1))];
813+
CCEffectBloom* glowEffect3 = [CCEffectBloom effectWithBlurRadius:8 intensity:1.0f luminanceThreshold:1.0f - ((float)i/(float)(steps-1))];
814+
glowEffect3.padding = CGSizeMake(10.0f, 10.0f);
618815
sampleSprite3.effect = glowEffect3;
619816

620817
[self.contentNode addChild:sampleSprite3];

cocos2d-ui/CCBReader/CCBReader.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1340,7 +1340,7 @@ - (CCNode*) readNodeGraphParent:(CCNode*)parent
13401340
// Class was not found. Maybe it's a Swift class?
13411341
// See http://stackoverflow.com/questions/24030814/swift-language-nsclassfromstring
13421342
NSString *appName = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleName"];
1343-
NSString *classStringName = [NSString stringWithFormat:@"_TtC%d%@%d%@", (int)appName.length, appName, (int)className.length, className];
1343+
NSString *classStringName = [NSString stringWithFormat:@"_TtC%lu%@%lu%@", (unsigned long)appName.length, appName, (unsigned long)className.length, className];
13441344
class = NSClassFromString(classStringName);
13451345
}
13461346
if (!class)

cocos2d/CCConfiguration.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
*/
2626

2727
#import <Foundation/Foundation.h>
28+
#import "CCGL.h"
2829

2930
#define CC_MINIMUM_TABLET_SCREEN_DIAGONAL 6.0
3031
extern Class CCGraphicsBufferClass;

cocos2d/CCEffect.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,11 @@
2929
/** An identifier for debugging effects. */
3030
@property (nonatomic, copy) NSString *debugName;
3131

32+
/** Padding in points that will be applied to affected sprites to avoid clipping the
33+
* effect's visuals at the sprite's boundary. For example, if you create a blur effect
34+
* whose radius will animate over time but will never exceed 8 points then you should
35+
* set the padding to at least 8 to avoid clipping.
36+
*/
37+
@property (nonatomic, assign) CGSize padding;
38+
3239
@end

0 commit comments

Comments
 (0)