Skip to content

Commit 7a67339

Browse files
committed
Merge branch 'develop-v3' of https://github.com/cocos2d/cocos2d-iphone into develop-v3
Former-commit-id: 9098301
2 parents cf0871a + 8144fe7 commit 7a67339

File tree

4 files changed

+106
-2
lines changed

4 files changed

+106
-2
lines changed

VERSION

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
3.0.0

cocos2d-ui-tests/tests/CCRendererTest.m

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,53 @@
11
#import "TestBase.h"
2+
#import "CCTextureCache.h"
23

34
@interface CCRendererTest : TestBase @end
45
@implementation CCRendererTest
56

7+
- (void)setupMotionStreakNodeTest
8+
{
9+
self.subTitle = @"Testing CCMotionStreak";
10+
11+
CCNode *stage = [CCNode node];
12+
stage.anchorPoint = ccp(0.5, 0.5);
13+
stage.positionType = CCPositionTypeNormalized;
14+
stage.position = ccp(0.5, 0.5);
15+
stage.contentSizeType = CCSizeTypeNormalized;
16+
stage.contentSize = CGSizeMake(0.75, 0.75);
17+
[self.contentNode addChild:stage];
18+
19+
// Maybe want to find a better texture than a random tile graphic?
20+
{
21+
CCMotionStreak *streak = [CCMotionStreak streakWithFade:15.0 minSeg:5 width:3 color:[CCColor whiteColor] textureFilename:@"Tiles/05.png"];
22+
[stage addChild:streak];
23+
24+
[streak scheduleBlock:^(CCTimer *timer) {
25+
CCTime t = timer.invokeTime;
26+
CGSize size = stage.contentSizeInPoints;
27+
28+
streak.position = ccp(size.width*(0.5 + 0.5*sin(3.1*t)), size.height*(0.5 + 0.5*cos(4.3*t)));
29+
30+
[timer repeatOnceWithInterval:0.01];
31+
} delay:0.0];
32+
}{
33+
CCMotionStreak *streak = [CCMotionStreak streakWithFade:0.5 minSeg:5 width:3 color:[CCColor redColor] textureFilename:@"Tiles/05.png"];
34+
[stage addChild:streak];
35+
36+
[streak scheduleBlock:^(CCTimer *timer) {
37+
CCTime t = timer.invokeTime;
38+
CGSize size = stage.contentSizeInPoints;
39+
40+
streak.position = ccp(size.width*(0.5 + 0.5*sin(1.6*t)), size.height*(0.5 + 0.5*cos(5.1*t)));
41+
42+
[timer repeatOnceWithInterval:0.01];
43+
} delay:0.0];
44+
}
45+
}
46+
647
- (void)setupProgressNodeTest
748
{
49+
self.subTitle = @"Testing various CCProgressNode setups.";
50+
851
// Radial timer
952
{
1053
NSString *image = @"Tiles/05.png";
@@ -158,10 +201,64 @@ - (void)setupProgressNodeTest
158201
[timer repeatOnceWithInterval:interval];
159202
} delay:interval];
160203
}
204+
205+
{
206+
NSString *image = @"Tiles/05.png";
207+
CGPoint position = ccp(0.4, 0.25);
208+
CCTime interval = 1.0/60.0;
209+
210+
CCSprite *sprite = [CCSprite spriteWithImageNamed:image];
211+
sprite.positionType = CCPositionTypeNormalized;
212+
sprite.position = position;
213+
sprite.color = [CCColor grayColor];
214+
[self.contentNode addChild:sprite];
215+
216+
CCProgressNode *progress = [CCProgressNode progressWithSprite:[CCSprite spriteWithImageNamed:image]];
217+
progress.type = CCProgressNodeTypeBar;
218+
progress.midpoint = ccp(0.5, 0.5);
219+
progress.barChangeRate = ccp(1, 1);
220+
progress.positionType = CCPositionTypeNormalized;
221+
progress.position = position;
222+
[self.contentNode addChild:progress];
223+
224+
[self scheduleBlock:^(CCTimer *timer) {
225+
progress.percentage = 100.0*(0.5 + 0.5*sin(timer.invokeTime*M_PI));
226+
227+
[timer repeatOnceWithInterval:interval];
228+
} delay:interval];
229+
}
230+
231+
{
232+
NSString *image = @"Tiles/05.png";
233+
CGPoint position = ccp(0.4, 0.5);
234+
CCTime interval = 1.0/60.0;
235+
236+
CCSprite *sprite = [CCSprite spriteWithImageNamed:image];
237+
sprite.positionType = CCPositionTypeNormalized;
238+
sprite.position = position;
239+
sprite.color = [CCColor grayColor];
240+
[self.contentNode addChild:sprite];
241+
242+
CCProgressNode *progress = [CCProgressNode progressWithSprite:[CCSprite spriteWithImageNamed:image]];
243+
progress.type = CCProgressNodeTypeBar;
244+
progress.midpoint = ccp(0.5, 0.5);
245+
progress.barChangeRate = ccp(0, 0);
246+
progress.positionType = CCPositionTypeNormalized;
247+
progress.position = position;
248+
[self.contentNode addChild:progress];
249+
250+
[self scheduleBlock:^(CCTimer *timer) {
251+
progress.percentage = 100.0*(0.5 + 0.5*sin(timer.invokeTime*M_PI));
252+
253+
[timer repeatOnceWithInterval:interval];
254+
} delay:interval];
255+
}
161256
}
162257

163258
- (void)setupDrawNodeTest
164259
{
260+
self.subTitle = @"Testing CCDrawNode";
261+
165262
CCDrawNode *draw = [CCDrawNode node];
166263

167264
[draw drawDot:ccp(100, 100) radius:50 color:[CCColor redColor]];

cocos2d-ui-tests/tests/VertexZTest.m

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,14 +73,20 @@ - (void)setupVertexZTest
7373
// add a card node to hold the cards
7474
_cardNode = [CCSpriteBatchNode batchNodeWithFile:@"Cards/cards.classic.png"];
7575
_cardNode.contentSize = [CCDirector sharedDirector].viewSize;
76+
77+
_cardNode.shaderProgram = [[CCShaderCache sharedShaderCache] programForKey:kCCShader_PositionTextureColorAlphaTest];
78+
GLint location = [_cardNode.shaderProgram uniformLocationForName:@(kCCUniformAlphaTestValue_s)];
79+
[_cardNode.shaderProgram setUniformLocation:location withF1:0.5];
80+
7681
[self.contentNode addChild:_cardNode];
7782

7883
// add an array of cards
7984
for (int count = 0; count < NUMBER_OF_CARDS; count ++)
8085
{
8186
CCSprite *card = [CCSprite spriteWithImageNamed:[self randomCard]];
87+
8288
card.positionType = CCPositionTypeNormalized;
83-
card.position = ccp(0.5 + (count - NUMBER_OF_CARDS / 2) * 0.02, 0.5);
89+
card.position = ccp(0.5 + (count - NUMBER_OF_CARDS / 2) * 0.02, 0.5 + (count - NUMBER_OF_CARDS / 2) * 0.01);
8490
[_cardNode addChild:card];
8591
}
8692
}

cocos2d/CCLayoutBox.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ - (void) layout
8484

8585
// Position the nodes
8686
float height = 0;
87-
for (CCNode* child in [[self.children reverseObjectEnumerator] allObjects])
87+
for (CCNode* child in self.children)
8888
{
8989
CGSize childSize = child.contentSizeInPoints;
9090

0 commit comments

Comments
 (0)