Skip to content

Instantly share code, notes, and snippets.

@C4Tutorials
Created April 8, 2013 19:46
Show Gist options
  • Save C4Tutorials/5339875 to your computer and use it in GitHub Desktop.
Save C4Tutorials/5339875 to your computer and use it in GitHub Desktop.
The canvas listening for all touches from all objects.
//
// C4WorkSpace.m
// Notification Tutorial
//
// Created by Travis Kirton.
//
#import "C4WorkSpace.h"
@implementation C4WorkSpace
-(void)setup {
[self listenFor:@"touchesBegan" andRunMethod:@"react"];
C4Shape *s = [C4Shape ellipse:CGRectMake(0, 0, 192, 192)];
s.center = self.canvas.center;
[self.canvas addShape:s];
}
-(void)react {
self.canvas.backgroundColor = [UIColor colorWithWhite:[C4Math randomInt:100]/100.0f alpha:1.0f];
}
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment