-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathIntroLayer.mm
66 lines (50 loc) · 1.36 KB
/
IntroLayer.mm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
//
// IntroLayer.m
// brendan game
//
// Created by Francis Tseng on 12/1/13.
// Copyright Francis Tseng 2013. All rights reserved.
//
// Import the interfaces
#import "IntroLayer.h"
#import "MenuLayer.h"
#pragma mark - IntroLayer
// HelloWorldLayer implementation
@implementation IntroLayer
// Helper class method that creates a Scene with the HelloWorldLayer as the only child.
+(CCScene *) scene
{
// 'scene' is an autorelease object.
CCScene *scene = [CCScene node];
// 'layer' is an autorelease object.
IntroLayer *layer = [IntroLayer node];
// add layer as a child to scene
[scene addChild: layer];
// return the scene
return scene;
}
//
-(id) init
{
if( (self=[super init])) {
// ask director for the window size
CGSize size = [[CCDirector sharedDirector] winSize];
CCSprite *background;
if( UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone ) {
background = [CCSprite spriteWithFile:@"Default.png"];
background.rotation = 90;
} else {
background = [CCSprite spriteWithFile:@"Default-Landscape~ipad.png"];
}
background.position = ccp(size.width/2, size.height/2);
// add the label as a child to this Layer
[self addChild: background];
}
return self;
}
-(void) onEnter
{
[super onEnter];
[[CCDirector sharedDirector] replaceScene:[CCTransitionFade transitionWithDuration:1.0 scene:[MenuLayer scene] ]];
}
@end