5 // Created by Killery on 2012/12/15.
6 // Copyright (c) 2012年 Killery. All rights reserved.
11 @implementation SChipView
13 - (id)initWithFrame:(NSRect)frame
15 self = [super initWithFrame:frame];
17 chip = [[self LoadImage:@"マス.png"] retain];
19 seRect.size.height = 1*32;
20 seRect.size.width = 1*32;
29 -(NSImage*)LoadImage:(NSString*)name{
30 NSImage *image = [NSImage imageNamed:name];
31 if(image == nil) return nil;
32 //[image setFlipped:[self isFlipped]];
36 -(void)DrawImage:(NSImage*)image x:(float)x y:(float)y cx:(int)cx cy:(int)cy{
38 frRect.size.height = image.size.height;
39 frRect.size.width = image.size.width;
47 drRect.size.height = 32;
48 drRect.size.width = 32;
50 [image drawInRect:drRect fromRect:frRect operation:NSCompositeSourceOver fraction:1.0f respectFlipped:YES hints:nil];
54 - (void)drawRect:(NSRect)dirtyRect
59 [self DrawImage:chip x:bx*32 y:by*32 cx:bx cy:by];