mirror of
https://github.com/libretro/RetroArch
synced 2025-03-29 22:20:21 +00:00
(Apple) Move more code to apple_gfx_context.c.inl
This commit is contained in:
parent
e6e3a01966
commit
f3b4aa0262
@ -30,33 +30,10 @@
|
||||
#include <CoreVideo/CVOpenGLESTextureCache.h>
|
||||
#endif
|
||||
|
||||
#define APP_HAS_FOCUS ([[UIApplication sharedApplication] applicationState] == UIApplicationStateActive)
|
||||
|
||||
#define GLContextClass EAGLContext
|
||||
|
||||
@interface EAGLContext (OSXCompat) @end
|
||||
@implementation EAGLContext (OSXCompat)
|
||||
+ (void)clearCurrentContext { [EAGLContext setCurrentContext:nil]; }
|
||||
- (void)makeCurrentContext { [EAGLContext setCurrentContext:self]; }
|
||||
@end
|
||||
|
||||
#elif defined(OSX)
|
||||
#define APP_HAS_FOCUS ([NSApp isActive])
|
||||
|
||||
#define GLContextClass NSOpenGLContext
|
||||
|
||||
#define g_view g_instance // < RAGameView is a container on iOS; on OSX these are both the same object
|
||||
|
||||
@interface NSScreen (IOSCompat) @end
|
||||
@implementation NSScreen (IOSCompat)
|
||||
- (CGRect)bounds
|
||||
{
|
||||
CGRect cgrect = NSRectToCGRect(self.frame);
|
||||
return CGRectMake(0, 0, CGRectGetWidth(cgrect), CGRectGetHeight(cgrect));
|
||||
}
|
||||
- (float) scale { return 1.0f; }
|
||||
@end
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef IOS
|
||||
|
@ -6,7 +6,25 @@
|
||||
#define GLAPIType GFX_CTX_OPENGL_ES_API
|
||||
#define GLFrameworkID CFSTR("com.apple.opengles")
|
||||
#define RAScreen UIScreen
|
||||
|
||||
@interface EAGLContext (OSXCompat) @end
|
||||
@implementation EAGLContext (OSXCompat)
|
||||
+ (void)clearCurrentContext { [EAGLContext setCurrentContext:nil]; }
|
||||
- (void)makeCurrentContext { [EAGLContext setCurrentContext:self]; }
|
||||
@end
|
||||
|
||||
#else
|
||||
|
||||
@interface NSScreen (IOSCompat) @end
|
||||
@implementation NSScreen (IOSCompat)
|
||||
- (CGRect)bounds
|
||||
{
|
||||
CGRect cgrect = NSRectToCGRect(self.frame);
|
||||
return CGRectMake(0, 0, CGRectGetWidth(cgrect), CGRectGetHeight(cgrect));
|
||||
}
|
||||
- (float) scale { return 1.0f; }
|
||||
@end
|
||||
|
||||
#define GLAPIType GFX_CTX_OPENGL_API
|
||||
#define GLFrameworkID CFSTR("com.apple.opengl")
|
||||
#define RAScreen NSScreen
|
||||
@ -214,7 +232,11 @@ static void apple_gfx_ctx_update_window_title(void *data)
|
||||
static bool apple_gfx_ctx_has_focus(void *data)
|
||||
{
|
||||
(void)data;
|
||||
return APP_HAS_FOCUS;
|
||||
#ifdef IOS
|
||||
return ([[UIApplication sharedApplication] applicationState] == UIApplicationStateActive);
|
||||
#else
|
||||
return [NSApp isActive];
|
||||
#endif
|
||||
}
|
||||
|
||||
static void apple_gfx_ctx_swap_buffers(void *data)
|
||||
|
Loading…
x
Reference in New Issue
Block a user