tunnel/iOS/CustomGLKView.m
2013-01-23 20:14:11 +00:00

69 lines
1.5 KiB
Objective-C
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

//
// CustomGLKView.m
// doublehitballs
//
// Created by vvv ооо on 15.07.12.
// Copyright (c) 2012 __MyCompanyName__. All rights reserved.
//
#import "CustomGLKView.h"
#import "ios_api.h"
bool touchMoved = false;
CGPoint prev_loc;
@implementation CustomGLKView
- (id)initWithFrame:(CGRect)frame
{
self = [super initWithFrame:frame];
if (self) {
// Initialization code
}
return self;
}
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
CGPoint location = [[[touches allObjects] objectAtIndex:0] locationInView:self];
prev_loc = location;
touchMoved = false;
AppOnTapDown(location.x, self.bounds.size.height - location.y);
}
- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event
{
CGPoint location = [[[touches allObjects] objectAtIndex:0] locationInView:self];
CGPoint prevLocation = [[[touches allObjects] objectAtIndex:0] previousLocationInView:self];
if (abs(prev_loc.x - location.x) > 10 || abs(prev_loc.y - location.y) > 10)
{
touchMoved = true;
}
AppOnScroll(prevLocation.x - location.x, prevLocation.y - location.y);
}
- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event
{
CGPoint location = [[[touches allObjects] objectAtIndex:0] locationInView:self];
if (!touchMoved)
{
AppOnTapUp(location.x, self.bounds.size.height - location.y);
}
}
@end