5
// Created by döme on 25.10.2009.
6
// Copyright 2009 __MyCompanyName__. All rights reserved.
9
#import "TappityView.h"
10
#import "TappityClient.h"
14
@implementation TappityView
17
- (id)initWithFrame:(CGRect)frame
19
if ((self = [super initWithFrame: frame]))
21
// Initialization code
27
- (void)drawRect:(CGRect)rect {
38
- (NSArray*) touchesAsPlist: (NSSet*) touches
40
NSMutableArray* ary = [NSMutableArray array];
41
for (UITouch* touch in touches)
43
NSMutableDictionary* dict = [NSMutableDictionary dictionary];
44
[dict setObject: [NSNumber numberWithInteger: (NSInteger)touch] forKey: @"touchIdentifier"];
45
[dict setObject: [NSNumber numberWithInteger: [touch phase]] forKey: @"touchPhase"];
46
[dict setObject: [NSNumber numberWithInteger: [touch tapCount]] forKey: @"touchTapCount"];
47
[dict setObject: [NSNumber numberWithFloat: [touch locationInView: self].x] forKey: @"touchX"];
48
[dict setObject: [NSNumber numberWithFloat: [touch locationInView: self].x] forKey: @"touchY"];
49
[dict setObject: [NSNumber numberWithFloat: [touch previousLocationInView: self].x] forKey: @"touchPX"];
50
[dict setObject: [NSNumber numberWithFloat: [touch previousLocationInView: self].x] forKey: @"touchPY"];
52
[ary addObject: dict];
57
- (void) touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
59
NSLog(@"touchesBegan");
62
[tapClient sendTouch: event inPhase: UITouchPhaseBegan];
65
- (void) touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event
67
NSLog(@"touchesEnded");
70
[tapClient sendTouch: event inPhase: UITouchPhaseEnded];
73
- (void) touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event
75
NSLog(@"touchesMoved");
78
[tapClient sendTouch: event inPhase: UITouchPhaseMoved];
81
- (void) touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event
83
NSLog(@"touchesCancelled");
86
[tapClient sendTouch: event inPhase: UITouchPhaseCancelled];
90
@synthesize tapClient;