-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathCharDef.m
55 lines (45 loc) · 987 Bytes
/
CharDef.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
//
// CharDef.m
// Tutorial1
//
// Created by Michael Daley on 08/03/2009.
// Copyright 2009 __MyCompanyName__. All rights reserved.
//
#import "CharDef.h"
@implementation CharDef
@synthesize image;
@synthesize charID;
@synthesize x;
@synthesize y;
@synthesize width;
@synthesize height;
@synthesize xOffset;
@synthesize yOffset;
@synthesize xAdvance;
@synthesize scale;
- (id)initCharDefWithFontImage:(Image*)fontImage scale:(float)fontScale{
self = [super init];
if (self != nil) {
// Reference the image file which contains the spritemap for the characters
image = fontImage;
// Set the scale for this character
scale = fontScale;
}
return self;
}
- (NSString *)description {
// Log what we have created
return [NSString stringWithFormat:@"CharDef = id:%d x:%d y:%d width:%d height:%d xoffset:%d yoffset:%d xadvance:%d",
charID,
x,
y,
width,
height,
xOffset,
yOffset,
xAdvance];
}
- (void)dealloc {
[super dealloc];
}
@end