-(void) directorDidReshapeProjection:(CCDirector*)director
{
if(director.runningScene == nil) {
// Add the first scene to the stack. The director will draw it immediately into the framebuffer. (Animation is started automatically when the view is displayed.)
// and add the scene to the stack. The director will run it when it automatically when the view is displayed.
[director runWithScene: [IntroLayer scene]];
}
}
@end
在AppDelegate.m對場景進行初始化時,導演類會跳轉到場景→IntroLayer scene
這個場景是在IntroLayer裏新建的類型爲CCScene
+(CCScene *) scene
這個場景會一閃而過,這個文件的最下面有個onEnter的實例方法,會直接跳轉到另一個場景→HelloWorldLayer scene
在HelloWorldLayer初始化時,init
-(id) init
{
// always call "super" init
// Apple recommends to re-assign "self" with the "super's" return value
if( (self=[super initWithColor:(ccc4(255,0,0,150))])) {
......
}
return self;
}
這裏的if( (self=[super initWithColor:(ccc4(255,0,0,150))])) {
......
會設置背景顏色!