mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-04-02 11:01:50 -04:00
iOS swipe gesture recognizer experiment
This commit is contained in:
parent
8756a2100e
commit
aa6962df4a
3 changed files with 20 additions and 2 deletions
|
@ -10,7 +10,7 @@
|
|||
#import "LocationHelper.h"
|
||||
|
||||
@interface ViewController : GLKViewController <iCadeEventDelegate,
|
||||
LocationHandlerDelegate, CameraFrameDelegate>
|
||||
LocationHandlerDelegate, CameraFrameDelegate, UIGestureRecognizerDelegate>
|
||||
|
||||
- (void)shareText:(NSString *)text;
|
||||
- (void)shutdown;
|
||||
|
|
|
@ -192,6 +192,12 @@ extern float g_safeInsetBottom;
|
|||
self.context = [[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES2];
|
||||
}
|
||||
|
||||
UISwipeGestureRecognizer *mSwipeLeftRecognizer = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(handleSwipeFrom:)];
|
||||
|
||||
[mSwipeLeftRecognizer setDirection:(UISwipeGestureRecognizerDirectionLeft | UISwipeGestureRecognizerDirectionRight)];
|
||||
|
||||
[[self view] addGestureRecognizer:mSwipeLeftRecognizer];
|
||||
|
||||
GLKView* view = (GLKView *)self.view;
|
||||
view.context = self.context;
|
||||
view.drawableDepthFormat = GLKViewDrawableDepthFormat24;
|
||||
|
@ -250,6 +256,17 @@ extern float g_safeInsetBottom;
|
|||
});
|
||||
}
|
||||
|
||||
- (void)handleSwipeFrom:(UISwipeGestureRecognizer *)recognizer
|
||||
{
|
||||
if (recognizer.direction == UISwipeGestureRecognizerDirectionLeft) {
|
||||
INFO_LOG(SYSTEM, "LEFT");
|
||||
} else if (recognizer.direction == UISwipeGestureRecognizerDirectionRight) {
|
||||
INFO_LOG(SYSTEM, "RIGHT");
|
||||
} else {
|
||||
INFO_LOG(SYSTEM, "OTHER SWIPE: %d", (int)recognizer.direction);
|
||||
}
|
||||
}
|
||||
|
||||
- (void)appWillTerminate:(NSNotification *)notification
|
||||
{
|
||||
[self shutdown];
|
||||
|
@ -753,7 +770,7 @@ void System_LaunchUrl(LaunchUrlType urlType, char const* url)
|
|||
{
|
||||
NSURL *nsUrl = [NSURL URLWithString:[NSString stringWithCString:url encoding:NSStringEncodingConversionAllowLossy]];
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
[[UIApplication sharedApplication] openURL:nsUrl] options:@{} completionHandler:nil];
|
||||
[[UIApplication sharedApplication] openURL:nsUrl options:@{} completionHandler:nil];
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -560,3 +560,4 @@ int main(int argc, char *argv[])
|
|||
return UIApplicationMain(argc, argv, NSStringFromClass([PPSSPPUIApplication class]), NSStringFromClass([AppDelegate class]));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue