Skip to content

Instantly share code, notes, and snippets.

@is8r
Created June 27, 2014 13:42
Show Gist options
  • Save is8r/7cc0e01595c0e8997a1b to your computer and use it in GitHub Desktop.
Save is8r/7cc0e01595c0e8997a1b to your computer and use it in GitHub Desktop.
-(id) init
{
if( (self=[super init])) {
//
CGSize stage = [[CCDirector sharedDirector] winSize];
//btn - onPress
CCSpriteBtn *b0 = [[CCSpriteBtn alloc] initWithFiles:@"b_border80.png" ro:@"b_border80_on.png"];
b0.Id = 0;
b0.position = ccp( b0.contentSize.width/2 , stage.height - b0.contentSize.height/2 );
[b0 addListner:self selector:@selector(onPress:)];
[b0 addLabel:@"onPress"];
[self addChild: b0];
}
return self;
}
-(void) onPress:(CCSpriteBtn*)sender
{
NSLog(@"onPress:%i", sender.Id);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment