(Apple) Move more code to apple_gfx_context.c.inl

This commit is contained in:
Twinaphex 2014-10-03 20:28:16 +02:00
parent e6e3a01966
commit f3b4aa0262
2 changed files with 23 additions and 24 deletions

View File

@ -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

View File

@ -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)