Skip to content

Instantly share code, notes, and snippets.

@timperrett
Created May 25, 2009 10:35
Show Gist options
  • Save timperrett/117491 to your computer and use it in GitHub Desktop.
Save timperrett/117491 to your computer and use it in GitHub Desktop.
@import <AppKit/CPView.j>
@implementation PatternView : CPView
{
}
- (id)initWithFrame:(CGRect)aFrame
{
self = [super initWithFrame:aFrame];
if (self){
//[self setImage:[[CPImage alloc] initWithContentsOfFile:@"Resources/note.png" size:CGSizeMake(525.0, 424.0)]];
var bgImage = [[CPImage alloc] initWithContentsOfFile:"Resources/note.png"];
[self setBackgroundColor:[CPColor colorWithPatternImage:bgImage]];
}
return self;
}
- (BOOL)acceptsFirstResponder {
return YES;
}
- (void) mouseDown:(CPEvent)event {
console.log("MOUSE PRESSSED");
console.log([event keyCode]);
}
- (void)keyDown:(CPEvent)anEvent {
console.log("PRESSSED");
}
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment