PDA

View Full Version : hello events




srinivas.be88
Aug 13, 2010, 07:39 AM
#import <UIKit/UIKit.h>
#import "HelloEvents.h"

enum
{
kTagSprite = 1,
};

@implementation HelloEvents

-(id) init
{
if( (self=[super init] )) {
self.isTouchEnabled = YES;
self.isAccelerometerEnabled = YES;
CCLabel* label = [CCLabel labelWithString:@"Hello Events" fontName:@"Marker Felt" fontSize:64];

CGSize size = [[CCDirector sharedDirector] winSize];

label.position = ccp( size.width /2 , size.height/2 );

[self addChild: label];
CCSprite *sprite = [CCSprite spriteWithFile:@"grossini.png"];
sprite.position = ccp( 50, 50);
[self addChild:sprite z:1 tag:kTagSprite];
}
return self;
}

- (void) dealloc
{
[super dealloc];
}


hi to all ,
i am new to this. please explain the enum tag why we put this and the [self addChild:sprite z:1 tag:kTagSprite];



chown33
Aug 13, 2010, 11:59 AM
The enum keyword means the same thing as in plain C.

Look it up in a C reference book or online article.