All Data Structures Files Functions Variables Enumerations Enumerator Properties Defines
/Projects/Cogito/src/Layers/Menu/StingLayer.m
Go to the documentation of this file.
00001 //
00002 //  StingLayer.m
00003 //  Author: Thomas Taylor
00004 //
00005 //  The intro 'animation' layer
00006 //
00007 //  16/12/2011: Created class
00008 //
00009 
00010 #import "StingLayer.h"
00011 
00012 @interface StingLayer()
00013 
00014 -(void)displayLogo;
00015 -(void)loadMainMenu;
00016 
00017 @end
00018 
00019 @implementation StingLayer
00020 
00021 #pragma mark -
00022 #pragma mark Initialisation
00023 
00028 -(id)init 
00029 {
00030  self = [super init];
00031     
00032  if (self != nil) 
00033  {
00034   CGSize winSize = [CCDirector sharedDirector].winSize;
00035         
00036         // add default backdround to make transitions look nicer 
00037   CCSprite *background = [CCSprite spriteWithFile:kFilenameDefBG];
00038         [background setPosition:ccp(winSize.width/2, winSize.height/2)];
00039   [self addChild:background z:0];
00040         
00041         [self displayLogo];
00042  }
00043     
00044  return self;
00045 }
00046 
00050 - (void)displayLogo
00051 {    
00052     CGSize winSize = [CCDirector sharedDirector].winSize;
00053     
00054     CCSprite *splashImage = [CCSprite spriteWithFile:kFilenameSplash];
00055     splashImage.opacity = 0.0f;
00056     [splashImage setPosition:ccp(winSize.width/2, winSize.height/2)];
00057     [self addChild:splashImage z:1];
00058     
00059     // create the sequence of actions
00060     id fadeIn = [CCFadeIn actionWithDuration:0.5f];
00061     id delay = [CCDelayTime actionWithDuration:2.0f];
00062     id fadeOut = [CCFadeOut actionWithDuration:0.75f];
00063     id loadMenu = [CCCallFunc actionWithTarget:self selector:@selector(loadMainMenu)];
00064     id logoSequence = [CCSequence actions:fadeIn, delay, fadeOut, loadMenu, nil];
00065     [splashImage runAction:logoSequence];
00066 }
00067 
00071 -(void)loadMainMenu 
00072 {
00073     [[GameManager sharedGameManager] runSceneWithID:kMainMenuScene];
00074 }
00075 
00076 @end