image wont display in custom nsview
image wont display in custom nsview
- Subject: image wont display in custom nsview
- From: Jeff Childers <email@hidden>
- Date: Thu, 6 Jan 2005 18:33:18 -0600
I have no idea why this wont work. It runs without errors
will you tell me whats wrong?
@interface SampleView : NSView
{
NSPoint drawPoint;
NSImage *bgImage;
NSImage *spriteImage;
}
- (void)drawRect: (NSRect)rect;
@end
________________________________________________________
@implementation SampleView
- (BOOL)acceptsFirstMouse: (NSEvent *)event {
YES);
}
- (void)awakeFromNib {
drawPoint = NSMakePoint(0);
bgImage = [NSImage imageNamed:@"body.png"];
spriteImage = [NSImage imageNamed:@"body.png"];
}
- (void)drawRect: (NSRect)rect {
[bgImage compositeToPoint:NSMakePoint(0) operation:NSCompositeSourceOver];
[spriteImage compositeToPoint:drawPoint operation:NSCompositeSourceOver];
[self setNeedsDisplay:YES];
}
- (void)mouseDown: (NSEvent *)event {
drawPoint = [self convertPoint:[event locationInWindow] fromView:nil];
NSLog(@"Mouse at %@", NSStringFromPoint(drawPoint));
[self setNeedsDisplay:YES];
}
- (BOOL)acceptsFirstResponder
{
return YES;
}
@end
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden