@@ -785,6 +785,60 @@ -(void)setupEffectNodeSizeTypeTest
785
785
}
786
786
}
787
787
788
+ -(void )setupEffectNodeResizeTest
789
+ {
790
+ NSArray *subTitles = @[
791
+ @" Effect Node Resize Test\n Small transparent blue node with grossini" ,
792
+ @" Effect Node Resize Test\n Medium transparent blue node with grossini" ,
793
+ @" Effect Node Resize Test\n Big transparent blue node with grossini"
794
+ ];
795
+
796
+ self.subTitle = subTitles[0 ];
797
+
798
+ CCSprite *background = [CCSprite spriteWithImageNamed: @" Images/gridBackground.png" ];
799
+ background.positionType = CCPositionTypeNormalized;
800
+ background.position = ccp (0 .5f , 0 .5f );
801
+ [self .contentNode addChild: background];
802
+
803
+ CCEffectNode* effectNode = [[CCEffectNode alloc ] init ];
804
+ effectNode.clearFlags = GL_COLOR_BUFFER_BIT;
805
+ effectNode.clearColor = [CCColor colorWithRed: 0 .5f green: 0 .0f blue: 0 .0f alpha: 0 .5f ];
806
+ effectNode.contentSizeType = CCSizeTypeNormalized;
807
+ effectNode.contentSize = CGSizeMake (0 .25f , 0 .25f );
808
+ effectNode.anchorPoint = ccp (0 .5f , 0 .5f );
809
+ effectNode.positionType = CCPositionTypeNormalized;
810
+ effectNode.position = ccp (0 .5f , 0 .5f );
811
+
812
+ CCEffectHue *effect = [CCEffectHue effectWithHue: -120 .0f ];
813
+ effectNode.effect = effect;
814
+
815
+ [self .contentNode addChild: effectNode];
816
+
817
+
818
+ CCSprite *sprite = [CCSprite spriteWithImageNamed: @" Images/grossini.png" ];
819
+ sprite.anchorPoint = ccp (0.5 , 0.5 );
820
+ sprite.positionType = CCPositionTypeNormalized;
821
+ sprite.position = ccp (0 .5f , 0 .5f );
822
+ [effectNode addChild: sprite];
823
+
824
+
825
+ __weak CCEffectsTest *weakSelf = self;
826
+ __block NSUInteger callCount = 0 ;
827
+ CCActionCallBlock *blockAction = [CCActionCallBlock actionWithBlock: ^{
828
+ callCount = (callCount + 1 ) % 3 ;
829
+
830
+ float nodeSize = 0 .25f + 0 .25f * callCount;
831
+ effectNode.contentSize = CGSizeMake (nodeSize, nodeSize);
832
+
833
+ weakSelf.subTitle = subTitles[callCount];
834
+ }];
835
+ [effectNode runAction: [CCActionRepeatForever actionWithAction: [CCActionSequence actions:
836
+ [CCActionDelay actionWithDuration: 1 .0f ],
837
+ blockAction,
838
+ nil
839
+ ]]];
840
+ }
841
+
788
842
-(void )setupEffectNodeChildPositioningTest
789
843
{
790
844
self.subTitle = @" Effect Node Child Positioning Test\n Big transparent purple quad and small opaque green quad (both with grossini).\n " ;
0 commit comments