NSRect is joking me or what?
NSRect is joking me or what?
- Subject: NSRect is joking me or what?
- From: Mathieu Labrie <email@hidden>
- Date: Sat, 3 Aug 2002 17:47:15 -0400
Well, I have this "click in the view to display an image at mouse click
position" test application but at this point my application is only
displaying images outside the view (on the application window..)
here's what I have:
- (void)drawMove {
NSImage *img = [NSImage imageNamed : @"image.png"];
NSRect rect = [self bounds];
[ img drawInRect : rect
fromRect : NSMakeRect( -(xCoord*20), -(yCoord*20), 400, 400
)
operation : NSCompositeSourceAtop
fraction : 1 ];
[self setNeedsDisplay:YES];
}
and:
- (void)mouseDown:(NSEvent *)theEvent {
int pos;
NSPoint loc = [self convertPoint:[theEvent locationInWindow]
fromView:[[self window] contentView]];
xCoord = floorf(loc.x/20);
yCoord = floorf(loc.y/20);
pos = (int)((256*yCoord)+xCoord +0.5);
[self drawMove];
}
Anyone could help me to find out why it's not drawing in the rect of
the view? I need to repair this quick to continue the development of my
board game.
Thanks in advance.
(Perhaps there was typing errors in this text but ignore them, I'm not
american).
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.