@@ -269,29 +269,35 @@ -(void)setupSimpleLightingTest
269
269
light.depth = lightDepth;
270
270
271
271
CCSprite *lightSprite = [CCSprite spriteWithImageNamed: @" Images/snow.png" ];
272
- [light addChild: lightSprite];
273
272
274
273
CCEffectLighting *lightingEffect = [[CCEffectLighting alloc ] initWithLights: @[light]];
275
274
lightingEffect.shininess = 10 .0f ;
276
275
277
276
CCSprite *sprite = [CCSprite spriteWithImageNamed: diffuseImage];
278
277
sprite.positionType = CCPositionTypeNormalized;
279
- sprite.position = position ;
278
+ sprite.position = ccp ( 0 . 5f , 0 . 5f ) ;
280
279
sprite.normalMapSpriteFrame = [CCSpriteFrame frameWithImageNamed: normalMapImage];
281
280
sprite.effect = lightingEffect;
282
281
sprite.scale = 0 .5f ;
283
282
284
- [self .contentNode addChild: sprite];
285
-
286
- [sprite addChild: light];
287
-
288
- CCLabelTTF *label = [CCLabelTTF labelWithString: title fontName: @" HelveticaNeue-Light" fontSize: 18 * [CCDirector sharedDirector ].UIScaleFactor];
283
+ CCNode *root = [[CCNode alloc ] init ];
284
+ root.positionType = CCPositionTypeNormalized;
285
+ root.position = position;
286
+ root.anchorPoint = ccp (0 .5f , 0 .5f );
287
+ root.contentSizeType = CCSizeTypePoints;
288
+ root.contentSize = CGSizeMake (200 .0f , 200 .0f );
289
+
290
+ CCLabelTTF *label = [CCLabelTTF labelWithString: title fontName: @" HelveticaNeue-Light" fontSize: 12 * [CCDirector sharedDirector ].UIScaleFactor];
289
291
label.color = [CCColor whiteColor ];
290
292
label.positionType = CCPositionTypeNormalized;
291
- label.position = ccp (0 .5f , 1 .1f );
293
+ label.position = ccp (0 .5f , 1 .0f );
292
294
label.horizontalAlignment = CCTextAlignmentCenter;
293
295
294
- [sprite addChild: label];
296
+ [self .contentNode addChild: root];
297
+ [root addChild: label];
298
+ [root addChild: sprite];
299
+ [root addChild: light];
300
+ [light addChild: lightSprite];
295
301
296
302
[light runAction: [CCActionRepeatForever actionWithAction: [CCActionSequence actions:
297
303
[CCActionMoveTo actionWithDuration: 1.0 position: ccp (1 .0f , 1 .0f )],
0 commit comments