//
//  BWEnemyView.m
//
//  Created by Simon on 16/06/16.
//

#import "BWEnemyView.h"

@implementation BWEnemyView

- (void)awakeFromNib
{
	scale = 1;
}

- (void)drawRect:(NSRect)rect
{
	[[NSColor blackColor] set];
	NSRectFill(rect);
	
	[[NSColor whiteColor] set];
	NSRect frame = NSInsetRect(rect, 1, 1);
	NSFrameRect(frame);
	
	NSImage *imageToDraw = [self image];
	NSPoint pt = { (rect.size.width / 2) - ([imageToDraw size].width / 2) , (rect.size.height / 2) - ([imageToDraw size].height / 2) };
	[imageToDraw compositeToPoint:pt operation:NSCompositeSourceOver];
	
	//NSPoint pt = { (rect.size.width / 2) - imageToDraw.size.width , (rect.size.height / 2) - imageToDraw.size.height };
	//NSRect doubleRect = { { pt.x , pt.y } , { [imageToDraw size].width * 2 , [imageToDraw size].height * 2 } };
	//[imageToDraw drawInRect:doubleRect fromRect:NSMakeRect(pt.x,pt.y,[imageToDraw size].width,[imageToDraw size].height) operation:NSCompositeSourceOver fraction:1.0];
}

- (void)mouseDown:(NSEvent *)event
{
	[self changeScale];
}

- (void)changeScale
{
	if (scale == 1) scale = 2;
	else scale = 1;
}

@end
