2013-01-19 20:02:34 +00:00
|
|
|
|
//
|
|
|
|
|
// 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;
|
|
|
|
|
}
|
|
|
|
|
|
2013-01-29 20:34:23 +00:00
|
|
|
|
AppOnScroll(prevLocation.x - location.x, -(prevLocation.y - location.y));
|
2013-01-19 20:02:34 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event
|
|
|
|
|
{
|
|
|
|
|
CGPoint location = [[[touches allObjects] objectAtIndex:0] locationInView:self];
|
|
|
|
|
|
2013-01-29 20:34:23 +00:00
|
|
|
|
if (touchMoved)
|
|
|
|
|
{
|
|
|
|
|
AppOnTapUpAfterScroll(location.x, self.bounds.size.height - location.y);
|
|
|
|
|
}
|
|
|
|
|
else
|
2013-01-19 20:02:34 +00:00
|
|
|
|
{
|
|
|
|
|
AppOnTapUp(location.x, self.bounds.size.height - location.y);
|
|
|
|
|
}
|
2013-01-29 20:34:23 +00:00
|
|
|
|
|
2013-01-19 20:02:34 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@end
|