@@ -990,7 +990,9 @@ -(void)setupEffectNodeResizeTest
990
990
NSArray *subTitles = @[
991
991
@" Effect Node Resize Test\n Small transparent blue node with grossini" ,
992
992
@" Effect Node Resize Test\n Medium transparent blue node with grossini" ,
993
- @" Effect Node Resize Test\n Big transparent blue node with grossini"
993
+ @" Effect Node Resize Test\n Big transparent blue node with grossini" ,
994
+ @" Effect Node Resize Test\n Nothing" ,
995
+ @" Effect Node Resize Test\n Transparent blue square with grossini"
994
996
];
995
997
996
998
self.subTitle = subTitles[0 ];
@@ -1025,10 +1027,117 @@ -(void)setupEffectNodeResizeTest
1025
1027
__weak CCEffectsTest *weakSelf = self;
1026
1028
__block NSUInteger callCount = 0 ;
1027
1029
CCActionCallBlock *blockAction = [CCActionCallBlock actionWithBlock: ^{
1028
- callCount = (callCount + 1 ) % 3 ;
1030
+ callCount = (callCount + 1 ) % 5 ;
1029
1031
1030
- float nodeSize = 0 .25f + 0 .25f * callCount;
1031
- effectNode.contentSize = CGSizeMake (nodeSize, nodeSize);
1032
+ if (callCount == 0 )
1033
+ {
1034
+ effectNode.contentSizeType = CCSizeTypeNormalized;
1035
+ }
1036
+
1037
+ if (callCount == 3 )
1038
+ {
1039
+ effectNode.contentSizeType = CCSizeTypePoints;
1040
+ }
1041
+ else if (callCount == 4 )
1042
+ {
1043
+ effectNode.contentSize = CGSizeMake (256 .0f , 256 .0f );
1044
+ }
1045
+ else
1046
+ {
1047
+ float nodeSize = 0 .25f + 0 .25f * callCount;
1048
+ effectNode.contentSize = CGSizeMake (nodeSize, nodeSize);
1049
+ }
1050
+
1051
+ weakSelf.subTitle = subTitles[callCount];
1052
+ }];
1053
+ [effectNode runAction: [CCActionRepeatForever actionWithAction: [CCActionSequence actions:
1054
+ [CCActionDelay actionWithDuration: 1 .0f ],
1055
+ blockAction,
1056
+ nil
1057
+ ]]];
1058
+ }
1059
+
1060
+ -(void )setupEffectNodeParentResizeTest
1061
+ {
1062
+ NSArray *subTitles = @[
1063
+ @" Effect Node Parent Resize Test\n Small transparent red rect with grossini" ,
1064
+ @" Effect Node Parent Resize Test\n Medium transparent red rect with grossini" ,
1065
+ @" Effect Node Parent Resize Test\n Big transparent red rect with grossini" ,
1066
+ @" Effect Node Parent Resize Test\n Nothing" ,
1067
+ @" Effect Node Parent Resize Test\n Transparent red square with grossini"
1068
+ ];
1069
+
1070
+ self.subTitle = subTitles[0 ];
1071
+
1072
+ CCSprite *background = [CCSprite spriteWithImageNamed: @" Images/gridBackground.png" ];
1073
+ background.positionType = CCPositionTypeNormalized;
1074
+ background.position = ccp (0 .5f , 0 .5f );
1075
+ [self .contentNode addChild: background];
1076
+
1077
+
1078
+ CCNode *grandparent = [[CCNode alloc ] init ];
1079
+ grandparent.contentSizeType = CCSizeTypeNormalized;
1080
+ grandparent.contentSize = CGSizeMake (0 .25f , 0 .25f );
1081
+ grandparent.anchorPoint = ccp (0 .5f , 0 .5f );
1082
+ grandparent.positionType = CCPositionTypeNormalized;
1083
+ grandparent.position = ccp (0 .5f , 0 .5f );
1084
+ [self .contentNode addChild: grandparent];
1085
+
1086
+
1087
+ CCNode *parent = [[CCNode alloc ] init ];
1088
+ parent.contentSizeType = CCSizeTypeNormalized;
1089
+ parent.contentSize = CGSizeMake (1 .0f , 1 .0f );
1090
+ parent.anchorPoint = ccp (0 .5f , 0 .5f );
1091
+ parent.positionType = CCPositionTypeNormalized;
1092
+ parent.position = ccp (0 .5f , 0 .5f );
1093
+ [grandparent addChild: parent];
1094
+
1095
+
1096
+ CCEffectNode *effectNode = [[CCEffectNode alloc ] init ];
1097
+ effectNode.clearFlags = GL_COLOR_BUFFER_BIT;
1098
+ effectNode.clearColor = [CCColor colorWithRed: 0 .0f green: 0 .0f blue: 0 .5f alpha: 0 .5f ];
1099
+ effectNode.contentSizeType = CCSizeTypeNormalized;
1100
+ effectNode.contentSize = CGSizeMake (1 .0f , 1 .0f );
1101
+ effectNode.anchorPoint = ccp (0 .5f , 0 .5f );
1102
+ effectNode.positionType = CCPositionTypeNormalized;
1103
+ effectNode.position = ccp (0 .5f , 0 .5f );
1104
+
1105
+ CCEffectHue *effect = [CCEffectHue effectWithHue: 120 .0f ];
1106
+ effectNode.effect = effect;
1107
+
1108
+ [parent addChild: effectNode];
1109
+
1110
+
1111
+ CCSprite *sprite = [CCSprite spriteWithImageNamed: @" Images/grossini.png" ];
1112
+ sprite.anchorPoint = ccp (0.5 , 0.5 );
1113
+ sprite.positionType = CCPositionTypeNormalized;
1114
+ sprite.position = ccp (0 .5f , 0 .5f );
1115
+ [effectNode addChild: sprite];
1116
+
1117
+
1118
+ __weak CCEffectsTest *weakSelf = self;
1119
+ __block NSUInteger callCount = 0 ;
1120
+ CCActionCallBlock *blockAction = [CCActionCallBlock actionWithBlock: ^{
1121
+ callCount = (callCount + 1 ) % 5 ;
1122
+
1123
+ if (callCount == 0 )
1124
+ {
1125
+ grandparent.contentSizeType = CCSizeTypeNormalized;
1126
+ }
1127
+
1128
+ if (callCount == 3 )
1129
+ {
1130
+ grandparent.contentSizeType = CCSizeTypePoints;
1131
+ }
1132
+ else if (callCount == 4 )
1133
+ {
1134
+ grandparent.contentSize = CGSizeMake (256 .0f , 256 .0f );
1135
+ }
1136
+ else
1137
+ {
1138
+ float grandparentSize = 0 .25f + 0 .25f * callCount;
1139
+ grandparent.contentSize = CGSizeMake (grandparentSize, grandparentSize);
1140
+ }
1032
1141
1033
1142
weakSelf.subTitle = subTitles[callCount];
1034
1143
}];
0 commit comments