forked from alisdair/Nodobo-Replay
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathTouch.m
41 lines (30 loc) · 812 Bytes
/
Touch.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
//
// Touch.m
// Nodobo Replay
//
// Created by Alisdair McDiarmid on 01/08/2010.
// Copyright 2010 Nodobo. All rights reserved.
//
#import "Touch.h"
@implementation Touch
@synthesize point;
@synthesize pressure;
+ (Touch *) touchWithPoint: (NSPoint) p pressure: (CGFloat) pr timestamp: (NSDate * ) t
{
return [[[Touch alloc] initWithPoint: p pressure: pr timestamp: t] autorelease];
}
- (Touch *) initWithPoint: (NSPoint) p pressure: (CGFloat) pr timestamp: (NSDate * ) t
{
self = [super init];
if (self == nil)
return nil;
point = NSMakePoint(p.x/2, 400.0 - p.y/2);
pressure = pr;
timestamp = [t retain];
return self;
}
- (NSString *) data
{
return [NSString stringWithFormat: @"%@, pressure %.2f", NSStringFromPoint(point), pressure];
}
@end