mirror of
https://github.com/libretro/RetroArch
synced 2025-03-18 04:21:19 +00:00
iOS: remove pause indicator; show the native UI menu using 4-finger swipe down gesture
This commit is contained in:
parent
b38994461c
commit
45b36d7d47
@ -60,7 +60,6 @@ static enum gfx_ctx_api cocoagl_api = GFX_CTX_NONE;
|
|||||||
|
|
||||||
#if defined(HAVE_COCOATOUCH)
|
#if defined(HAVE_COCOATOUCH)
|
||||||
static GLKView *g_view;
|
static GLKView *g_view;
|
||||||
UIView *g_pause_indicator_view;
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static GLContextClass* g_hw_ctx;
|
static GLContextClass* g_hw_ctx;
|
||||||
@ -151,16 +150,9 @@ static void cocoagl_gfx_ctx_set_flags(void *data, uint32_t flags)
|
|||||||
void *glkitview_init(void)
|
void *glkitview_init(void)
|
||||||
{
|
{
|
||||||
#if defined(HAVE_COCOATOUCH)
|
#if defined(HAVE_COCOATOUCH)
|
||||||
#if TARGET_OS_IOS
|
|
||||||
/* iOS Pause menu and lifecycle. */
|
|
||||||
UINib *xib = (UINib*)[UINib nibWithNibName:BOXSTRING("PauseIndicatorView") bundle:nil];
|
|
||||||
g_pause_indicator_view = [[xib instantiateWithOwner:[RetroArch_iOS get] options:nil] lastObject];
|
|
||||||
#endif
|
|
||||||
|
|
||||||
g_view = [GLKView new];
|
g_view = [GLKView new];
|
||||||
#if TARGET_OS_IOS
|
#if TARGET_OS_IOS
|
||||||
g_view.multipleTouchEnabled = YES;
|
g_view.multipleTouchEnabled = YES;
|
||||||
[g_view addSubview:g_pause_indicator_view];
|
|
||||||
#endif
|
#endif
|
||||||
g_view.enableSetNeedsDisplay = NO;
|
g_view.enableSetNeedsDisplay = NO;
|
||||||
|
|
||||||
|
@ -31,7 +31,6 @@
|
|||||||
#import "GCDWebUploader.h"
|
#import "GCDWebUploader.h"
|
||||||
#import "WebServer.h"
|
#import "WebServer.h"
|
||||||
|
|
||||||
extern UIView *g_pause_indicator_view;
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_METAL
|
#ifdef HAVE_METAL
|
||||||
@ -113,7 +112,10 @@ void *glkitview_init(void);
|
|||||||
#elif defined(HAVE_COCOATOUCH)
|
#elif defined(HAVE_COCOATOUCH)
|
||||||
self.view = (BRIDGE GLKView*)glkitview_init();
|
self.view = (BRIDGE GLKView*)glkitview_init();
|
||||||
#if TARGET_OS_IOS
|
#if TARGET_OS_IOS
|
||||||
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(showPauseIndicator) name:UIApplicationWillEnterForegroundNotification object:nil];
|
UISwipeGestureRecognizer *swipe = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(showNativeMenu)];
|
||||||
|
swipe.numberOfTouchesRequired = 4;
|
||||||
|
swipe.direction = UISwipeGestureRecognizerDirectionDown;
|
||||||
|
[self.view addGestureRecognizer:swipe];
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -179,6 +181,10 @@ void *glkitview_init(void);
|
|||||||
}
|
}
|
||||||
|
|
||||||
#elif TARGET_OS_IOS
|
#elif TARGET_OS_IOS
|
||||||
|
-(void) showNativeMenu {
|
||||||
|
[[RetroArch_iOS get] toggleUI];
|
||||||
|
}
|
||||||
|
|
||||||
- (UIRectEdge)preferredScreenEdgesDeferringSystemGestures
|
- (UIRectEdge)preferredScreenEdgesDeferringSystemGestures
|
||||||
{
|
{
|
||||||
return UIRectEdgeBottom;
|
return UIRectEdgeBottom;
|
||||||
@ -218,13 +224,6 @@ void *glkitview_init(void);
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)showPauseIndicator
|
|
||||||
{
|
|
||||||
g_pause_indicator_view.alpha = 1.0f;
|
|
||||||
[NSObject cancelPreviousPerformRequestsWithTarget:g_instance];
|
|
||||||
[g_instance performSelector:@selector(hidePauseButton) withObject:g_instance afterDelay:3.0f];
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void)viewWillLayoutSubviews
|
- (void)viewWillLayoutSubviews
|
||||||
{
|
{
|
||||||
float width = 0.0f, height = 0.0f, tenpctw, tenpcth;
|
float width = 0.0f, height = 0.0f, tenpctw, tenpcth;
|
||||||
@ -248,21 +247,9 @@ void *glkitview_init(void);
|
|||||||
tenpctw = width / 10.0f;
|
tenpctw = width / 10.0f;
|
||||||
tenpcth = height / 10.0f;
|
tenpcth = height / 10.0f;
|
||||||
|
|
||||||
g_pause_indicator_view.frame = CGRectMake(tenpctw * 4.0f, 0.0f, tenpctw * 2.0f, tenpcth);
|
|
||||||
[g_pause_indicator_view viewWithTag:1].frame = CGRectMake(0, 0, tenpctw * 2.0f, tenpcth);
|
|
||||||
[self adjustViewFrameForSafeArea];
|
[self adjustViewFrameForSafeArea];
|
||||||
}
|
}
|
||||||
|
|
||||||
#define ALMOST_INVISIBLE (.021f)
|
|
||||||
|
|
||||||
- (void)hidePauseButton
|
|
||||||
{
|
|
||||||
[UIView animateWithDuration:0.2
|
|
||||||
animations:^{ g_pause_indicator_view.alpha = ALMOST_INVISIBLE; }
|
|
||||||
completion:^(BOOL finished) { }
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
/* NOTE: This version runs on iOS6+. */
|
/* NOTE: This version runs on iOS6+. */
|
||||||
- (NSUInteger)supportedInterfaceOrientations
|
- (NSUInteger)supportedInterfaceOrientations
|
||||||
{
|
{
|
||||||
@ -295,8 +282,6 @@ void *glkitview_init(void);
|
|||||||
- (void)viewDidAppear:(BOOL)animated
|
- (void)viewDidAppear:(BOOL)animated
|
||||||
{
|
{
|
||||||
#if TARGET_OS_IOS
|
#if TARGET_OS_IOS
|
||||||
/* Pause Menus. */
|
|
||||||
[self showPauseIndicator];
|
|
||||||
if (@available(iOS 11.0, *)) {
|
if (@available(iOS 11.0, *)) {
|
||||||
[self setNeedsUpdateOfHomeIndicatorAutoHidden];
|
[self setNeedsUpdateOfHomeIndicatorAutoHidden];
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user