(Apple) Make apple_gfx_context.c.inl more self-contained

This commit is contained in:
Twinaphex 2014-10-03 21:47:46 +02:00
parent d89b5b2f41
commit 53d2c8164b
2 changed files with 21 additions and 9 deletions

View File

@ -31,17 +31,12 @@
#include <CoreVideo/CVOpenGLESTextureCache.h>
#endif
#define GLContextClass EAGLContext
#elif defined(OSX)
#define GLContextClass NSOpenGLContext
/* RAGameView is a container on iOS;
* on OSX these are both the same object
*/
#define g_view g_instance
#endif
#ifdef IOS
@ -54,7 +49,6 @@ static UIView *g_pause_indicator_view;
#endif
static RAGameView* g_instance;
static GLContextClass* g_context;
@implementation RAGameView
+ (RAGameView*)get
@ -91,17 +85,19 @@ static GLContextClass* g_context;
#ifdef OSX
static void apple_gfx_ctx_update(void);
static void apple_gfx_ctx_flush_buffer(void);
- (void)setFrame:(NSRect)frameRect
{
[super setFrame:frameRect];
if (g_context)
[g_context update];
apple_gfx_ctx_update();
}
- (void)display
{
[g_context flushBuffer];
apple_gfx_ctx_flush_buffer();
}
/* Stop the annoying sound when pressing a key. */

View File

@ -3,6 +3,7 @@
#include "../../gfx/gl_common.h"
#ifdef IOS
#define GLContextClass EAGLContext
#define GLFrameworkID CFSTR("com.apple.opengles")
#define RAScreen UIScreen
@ -14,6 +15,7 @@
#else
@interface NSScreen (IOSCompat) @end
@implementation NSScreen (IOSCompat)
- (CGRect)bounds
@ -24,11 +26,13 @@
- (float) scale { return 1.0f; }
@end
#define GLContextClass NSOpenGLContext
#define GLFrameworkID CFSTR("com.apple.opengl")
#define RAScreen NSScreen
#endif
static GLContextClass* g_hw_ctx;
static GLContextClass* g_context;
static int g_fast_forward_skips;
static bool g_is_syncing = true;
@ -65,6 +69,18 @@ static RAScreen* get_chosen_screen(void)
#endif
}
static void apple_gfx_ctx_update(void)
{
if (g_context)
[g_context update];
}
static void apple_gfx_ctx_flush_buffer(void)
{
if (g_context)
[g_context flushBuffer];
}
static bool apple_gfx_ctx_init(void *data)
{
(void)data;