Skip to content

Commit 0bda1e7

Browse files
author
Thayer J Andrews
committed
CCEffectsTest - Switch test image and effect for padding test
I don't want to introduce yet another test image.
1 parent b534ffc commit 0bda1e7

File tree

1 file changed

+20
-18
lines changed

1 file changed

+20
-18
lines changed

cocos2d-ui-tests/tests/CCEffectsTest.m

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -24,53 +24,55 @@ -(void)setupPaddingEffectTest
2424
{
2525
self.subTitle = @"Effect Padding Test";
2626

27-
CCSprite *original = [CCSprite spriteWithImageNamed:@"Images/WhiteDiamond.png"];
27+
CCSprite *original = [CCSprite spriteWithImageNamed:@"Images/particles.png"];
2828
original.positionType = CCPositionTypeNormalized;
29-
original.position = ccp(0.25, 0.5);
29+
original.position = ccp(0.75, 0.75);
3030

3131
[self.contentNode addChild:original];
3232

3333
CCLabelTTF *title1 = [CCLabelTTF labelWithString:@"Original Sprite" fontName:@"HelveticaNeue-Light" fontSize:14 * [CCDirector sharedDirector].UIScaleFactor];
3434
title1.color = [CCColor whiteColor];
3535
title1.positionType = CCPositionTypeNormalized;
36-
title1.position = ccp(0.25f, 0.1f);
36+
title1.position = ccp(0.25f, 0.75f);
3737
title1.horizontalAlignment = CCTextAlignmentCenter;
3838

3939
[self.contentNode addChild:title1];
4040

4141

42-
CCSprite *blurred = [CCSprite spriteWithImageNamed:@"Images/WhiteDiamond.png"];
43-
blurred.positionType = CCPositionTypeNormalized;
44-
blurred.position = ccp(0.5, 0.5);
42+
\
43+
CCSprite *affected = [CCSprite spriteWithImageNamed:@"Images/particles.png"];
44+
affected.positionType = CCPositionTypeNormalized;
45+
affected.position = ccp(0.75, 0.5);
4546

46-
CCEffect *blur1 = [CCEffectBlur effectWithBlurRadius:4.0f];
47-
blurred.effect = blur1;
47+
CCEffectColorChannelOffset *offset1 = [CCEffectColorChannelOffset effectWithRedOffset:GLKVector2Make(5.0f, 0.0f) greenOffset:GLKVector2Make(-4.0f, 4.0f) blueOffset:GLKVector2Make(-4.0f, -4.0f)];
48+
affected.effect = offset1;
4849

49-
[self.contentNode addChild:blurred];
50+
[self.contentNode addChild:affected];
5051

51-
CCLabelTTF *title2 = [CCLabelTTF labelWithString:@"Blur (no padding)" fontName:@"HelveticaNeue-Light" fontSize:14 * [CCDirector sharedDirector].UIScaleFactor];
52+
CCLabelTTF *title2 = [CCLabelTTF labelWithString:@"Color channel offset (no padding)" fontName:@"HelveticaNeue-Light" fontSize:14 * [CCDirector sharedDirector].UIScaleFactor];
5253
title2.color = [CCColor whiteColor];
5354
title2.positionType = CCPositionTypeNormalized;
54-
title2.position = ccp(0.5f, 0.1f);
55+
title2.position = ccp(0.25f, 0.5f);
5556
title2.horizontalAlignment = CCTextAlignmentCenter;
5657

5758
[self.contentNode addChild:title2];
5859

5960

60-
CCSprite *padded = [CCSprite spriteWithImageNamed:@"Images/WhiteDiamond.png"];
61+
62+
CCSprite *padded = [CCSprite spriteWithImageNamed:@"Images/particles.png"];
6163
padded.positionType = CCPositionTypeNormalized;
62-
padded.position = ccp(0.75, 0.5);
64+
padded.position = ccp(0.75, 0.25);
6365

64-
CCEffect *blur2 = [CCEffectBlur effectWithBlurRadius:4.0f];
65-
blur2.padding = CGSizeMake(20.0f, 20.0f);
66-
padded.effect = blur2;
66+
CCEffectColorChannelOffset *offset2 = [CCEffectColorChannelOffset effectWithRedOffset:GLKVector2Make(5.0f, 0.0f) greenOffset:GLKVector2Make(-4.0f, 4.0f) blueOffset:GLKVector2Make(-4.0f, -4.0f)];
67+
offset2.padding = CGSizeMake(5.0f, 5.0f);
68+
padded.effect = offset2;
6769

6870
[self.contentNode addChild:padded];
6971

70-
CCLabelTTF *title3 = [CCLabelTTF labelWithString:@"Padded Blur" fontName:@"HelveticaNeue-Light" fontSize:14 * [CCDirector sharedDirector].UIScaleFactor];
72+
CCLabelTTF *title3 = [CCLabelTTF labelWithString:@"Color channel offset (with padding)" fontName:@"HelveticaNeue-Light" fontSize:14 * [CCDirector sharedDirector].UIScaleFactor];
7173
title3.color = [CCColor whiteColor];
7274
title3.positionType = CCPositionTypeNormalized;
73-
title3.position = ccp(0.75f, 0.1f);
75+
title3.position = ccp(0.25f, 0.25f);
7476
title3.horizontalAlignment = CCTextAlignmentCenter;
7577

7678
[self.contentNode addChild:title3];

0 commit comments

Comments
 (0)