From 6a1b50a29f16e811c471cca126225ff6538fa8a7 Mon Sep 17 00:00:00 2001 From: Vladislav Khorev Date: Tue, 29 Jan 2013 20:34:23 +0000 Subject: [PATCH] ios stuff --- Templates/SalmonUniversalTemplate/iOS/CustomGLKView.m | 9 +++++++-- Templates/SalmonUniversalTemplate/iOS/ios_api.cpp | 11 ++++++++--- Templates/SalmonUniversalTemplate/iOS/ios_api.h | 1 + 3 files changed, 16 insertions(+), 5 deletions(-) diff --git a/Templates/SalmonUniversalTemplate/iOS/CustomGLKView.m b/Templates/SalmonUniversalTemplate/iOS/CustomGLKView.m index 130b654..30d1a3f 100644 --- a/Templates/SalmonUniversalTemplate/iOS/CustomGLKView.m +++ b/Templates/SalmonUniversalTemplate/iOS/CustomGLKView.m @@ -49,17 +49,22 @@ CGPoint prev_loc; touchMoved = true; } - AppOnScroll(prevLocation.x - location.x, prevLocation.y - location.y); + 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) + if (touchMoved) + { + AppOnTapUpAfterScroll(location.x, self.bounds.size.height - location.y); + } + else { AppOnTapUp(location.x, self.bounds.size.height - location.y); } + } diff --git a/Templates/SalmonUniversalTemplate/iOS/ios_api.cpp b/Templates/SalmonUniversalTemplate/iOS/ios_api.cpp index e8c79cc..7f46ee7 100644 --- a/Templates/SalmonUniversalTemplate/iOS/ios_api.cpp +++ b/Templates/SalmonUniversalTemplate/iOS/ios_api.cpp @@ -32,16 +32,21 @@ extern "C" void AppDraw() extern "C" void AppOnTapDown(int posx, int posy) { - //App.OuterOnTapDown(vec2(posx, posy)); + App.OuterOnTapDown(vec2(posx, posy)); } extern "C" void AppOnTapUp(int posx, int posy) { - //App.OuterOnTapUp(vec2(posx, posy)); + App.OuterOnTapUp(vec2(posx, posy)); +} + +extern "C" void AppOnTapUpAfterScroll(int posx, int posy) +{ + App.OuterOnTapUpAfterShift(vec2(posx, posy)); } extern "C" void AppOnScroll(int shiftx, int shifty) { - //App.OuterOnMove(vec2(shiftx, shifty)); + App.OuterOnMove(vec2(shiftx, shifty)); } diff --git a/Templates/SalmonUniversalTemplate/iOS/ios_api.h b/Templates/SalmonUniversalTemplate/iOS/ios_api.h index 66b7e7f..aa8d8bf 100644 --- a/Templates/SalmonUniversalTemplate/iOS/ios_api.h +++ b/Templates/SalmonUniversalTemplate/iOS/ios_api.h @@ -12,4 +12,5 @@ void AppUpdate(int dt); void AppDraw(); void AppOnTapDown(int posx, int posy); void AppOnTapUp(int posx, int posy); +void AppOnTapUpAfterScroll(int posx, int posy); void AppOnScroll(int shiftx, int shifty); \ No newline at end of file