mirror of
https://github.com/libretro/RetroArch
synced 2025-02-09 09:39:56 +00:00
(Apple/Cocoa) Rename gfx_ctx_apple to gfx_ctx_cocoa
This commit is contained in:
parent
8818eb8cca
commit
d74f5ad3aa
@ -200,7 +200,7 @@ void *nsview_get_ptr(void)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* forward declarations */
|
/* forward declarations */
|
||||||
void apple_gfx_ctx_update(void);
|
void cocoagl_gfx_ctx_update(void);
|
||||||
void *glkitview_init(void);
|
void *glkitview_init(void);
|
||||||
|
|
||||||
@implementation RAGameView
|
@implementation RAGameView
|
||||||
@ -232,7 +232,7 @@ void *glkitview_init(void);
|
|||||||
{
|
{
|
||||||
[super setFrame:frameRect];
|
[super setFrame:frameRect];
|
||||||
|
|
||||||
apple_gfx_ctx_update();
|
cocoagl_gfx_ctx_update();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Stop the annoying sound when pressing a key. */
|
/* Stop the annoying sound when pressing a key. */
|
||||||
|
@ -110,7 +110,7 @@ void get_ios_version(int *major, int *minor)
|
|||||||
*minor = [decomposed_os_version[1] integerValue];
|
*minor = [decomposed_os_version[1] integerValue];
|
||||||
}
|
}
|
||||||
|
|
||||||
extern float apple_gfx_ctx_get_native_scale(void);
|
extern float cocoagl_gfx_ctx_get_native_scale(void);
|
||||||
|
|
||||||
/* Input helpers: This is kept here because it needs ObjC */
|
/* Input helpers: This is kept here because it needs ObjC */
|
||||||
static void handle_touch_event(NSArray* touches)
|
static void handle_touch_event(NSArray* touches)
|
||||||
@ -118,7 +118,7 @@ static void handle_touch_event(NSArray* touches)
|
|||||||
unsigned i;
|
unsigned i;
|
||||||
driver_t *driver = driver_get_ptr();
|
driver_t *driver = driver_get_ptr();
|
||||||
apple_input_data_t *apple = (apple_input_data_t*)driver->input_data;
|
apple_input_data_t *apple = (apple_input_data_t*)driver->input_data;
|
||||||
float scale = apple_gfx_ctx_get_native_scale();
|
float scale = cocoagl_gfx_ctx_get_native_scale();
|
||||||
|
|
||||||
if (!apple)
|
if (!apple)
|
||||||
return;
|
return;
|
||||||
|
@ -109,7 +109,7 @@ void *glkitview_init(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef IOS
|
#ifdef IOS
|
||||||
void apple_bind_game_view_fbo(void)
|
void cocoagl_bind_game_view_fbo(void)
|
||||||
{
|
{
|
||||||
if (g_context)
|
if (g_context)
|
||||||
[g_view bindDrawable];
|
[g_view bindDrawable];
|
||||||
@ -133,7 +133,7 @@ static RAScreen* get_chosen_screen(void)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void apple_gfx_ctx_update(void)
|
void cocoagl_gfx_ctx_update(void)
|
||||||
{
|
{
|
||||||
#ifdef OSX
|
#ifdef OSX
|
||||||
#if MAC_OS_X_VERSION_10_7 && !defined(HAVE_NSOPENGL)
|
#if MAC_OS_X_VERSION_10_7 && !defined(HAVE_NSOPENGL)
|
||||||
@ -144,7 +144,7 @@ void apple_gfx_ctx_update(void)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool apple_gfx_ctx_init(void *data)
|
static bool cocoagl_gfx_ctx_init(void *data)
|
||||||
{
|
{
|
||||||
(void)data;
|
(void)data;
|
||||||
|
|
||||||
@ -192,7 +192,7 @@ static bool apple_gfx_ctx_init(void *data)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void apple_gfx_ctx_destroy(void *data)
|
static void cocoagl_gfx_ctx_destroy(void *data)
|
||||||
{
|
{
|
||||||
(void)data;
|
(void)data;
|
||||||
|
|
||||||
@ -216,7 +216,7 @@ static void apple_gfx_ctx_destroy(void *data)
|
|||||||
g_context = nil;
|
g_context = nil;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool apple_gfx_ctx_bind_api(void *data, enum gfx_ctx_api api, unsigned major, unsigned minor)
|
static bool cocoagl_gfx_ctx_bind_api(void *data, enum gfx_ctx_api api, unsigned major, unsigned minor)
|
||||||
{
|
{
|
||||||
(void)data;
|
(void)data;
|
||||||
#if defined(IOS)
|
#if defined(IOS)
|
||||||
@ -233,7 +233,7 @@ static bool apple_gfx_ctx_bind_api(void *data, enum gfx_ctx_api api, unsigned ma
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void apple_gfx_ctx_swap_interval(void *data, unsigned interval)
|
static void cocoagl_gfx_ctx_swap_interval(void *data, unsigned interval)
|
||||||
{
|
{
|
||||||
(void)data;
|
(void)data;
|
||||||
#ifdef IOS // < No way to disable Vsync on iOS?
|
#ifdef IOS // < No way to disable Vsync on iOS?
|
||||||
@ -251,7 +251,7 @@ static void apple_gfx_ctx_swap_interval(void *data, unsigned interval)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool apple_gfx_ctx_set_video_mode(void *data, unsigned width, unsigned height, bool fullscreen)
|
static bool cocoagl_gfx_ctx_set_video_mode(void *data, unsigned width, unsigned height, bool fullscreen)
|
||||||
{
|
{
|
||||||
#ifdef OSX
|
#ifdef OSX
|
||||||
RAGameView *g_view = (RAGameView*)nsview_get_ptr();
|
RAGameView *g_view = (RAGameView*)nsview_get_ptr();
|
||||||
@ -276,12 +276,12 @@ static bool apple_gfx_ctx_set_video_mode(void *data, unsigned width, unsigned he
|
|||||||
|
|
||||||
(void)data;
|
(void)data;
|
||||||
|
|
||||||
// TODO: Maybe iOS users should be apple to show/hide the status bar here?
|
// TODO: Maybe iOS users should be able to show/hide the status bar here?
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
float apple_gfx_ctx_get_native_scale(void)
|
float cocoagl_gfx_ctx_get_native_scale(void)
|
||||||
{
|
{
|
||||||
static float ret = 0.0f;
|
static float ret = 0.0f;
|
||||||
SEL selector = NSSelectorFromString(BOXSTRING("nativeScale"));
|
SEL selector = NSSelectorFromString(BOXSTRING("nativeScale"));
|
||||||
@ -309,11 +309,11 @@ float apple_gfx_ctx_get_native_scale(void)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void apple_gfx_ctx_get_video_size(void *data, unsigned* width, unsigned* height)
|
static void cocoagl_gfx_ctx_get_video_size(void *data, unsigned* width, unsigned* height)
|
||||||
{
|
{
|
||||||
RAScreen *screen = (RAScreen*)get_chosen_screen();
|
RAScreen *screen = (RAScreen*)get_chosen_screen();
|
||||||
CGRect size = screen.bounds;
|
CGRect size = screen.bounds;
|
||||||
float screenscale = apple_gfx_ctx_get_native_scale();
|
float screenscale = cocoagl_gfx_ctx_get_native_scale();
|
||||||
|
|
||||||
#if defined(OSX)
|
#if defined(OSX)
|
||||||
RAGameView *g_view = (RAGameView*)nsview_get_ptr();
|
RAGameView *g_view = (RAGameView*)nsview_get_ptr();
|
||||||
@ -327,7 +327,7 @@ static void apple_gfx_ctx_get_video_size(void *data, unsigned* width, unsigned*
|
|||||||
*height = CGRectGetHeight(size) * screenscale;
|
*height = CGRectGetHeight(size) * screenscale;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void apple_gfx_ctx_update_window_title(void *data)
|
static void cocoagl_gfx_ctx_update_window_title(void *data)
|
||||||
{
|
{
|
||||||
static char buf[128], buf_fps[128];
|
static char buf[128], buf_fps[128];
|
||||||
bool got_text = video_monitor_get_fps(buf, sizeof(buf),
|
bool got_text = video_monitor_get_fps(buf, sizeof(buf),
|
||||||
@ -346,7 +346,7 @@ static void apple_gfx_ctx_update_window_title(void *data)
|
|||||||
rarch_main_msg_queue_push(buf_fps, 1, 1, false);
|
rarch_main_msg_queue_push(buf_fps, 1, 1, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool apple_gfx_ctx_get_metrics(void *data, enum display_metric_types type,
|
static bool cocoagl_gfx_ctx_get_metrics(void *data, enum display_metric_types type,
|
||||||
float *value)
|
float *value)
|
||||||
{
|
{
|
||||||
#ifdef OSX
|
#ifdef OSX
|
||||||
@ -361,7 +361,7 @@ static bool apple_gfx_ctx_get_metrics(void *data, enum display_metric_types type
|
|||||||
float physical_width = display_physical_size.width;
|
float physical_width = display_physical_size.width;
|
||||||
float physical_height = display_physical_size.height;
|
float physical_height = display_physical_size.height;
|
||||||
#elif defined(IOS)
|
#elif defined(IOS)
|
||||||
float scale = apple_gfx_ctx_get_native_scale();
|
float scale = cocoagl_gfx_ctx_get_native_scale();
|
||||||
CGRect screen_rect = [[UIScreen mainScreen] bounds];
|
CGRect screen_rect = [[UIScreen mainScreen] bounds];
|
||||||
|
|
||||||
float display_width = screen_rect.size.width;
|
float display_width = screen_rect.size.width;
|
||||||
@ -393,7 +393,7 @@ static bool apple_gfx_ctx_get_metrics(void *data, enum display_metric_types type
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool apple_gfx_ctx_has_focus(void *data)
|
static bool cocoagl_gfx_ctx_has_focus(void *data)
|
||||||
{
|
{
|
||||||
(void)data;
|
(void)data;
|
||||||
#ifdef IOS
|
#ifdef IOS
|
||||||
@ -403,7 +403,7 @@ static bool apple_gfx_ctx_has_focus(void *data)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool apple_gfx_ctx_suppress_screensaver(void *data, bool enable)
|
static bool cocoagl_gfx_ctx_suppress_screensaver(void *data, bool enable)
|
||||||
{
|
{
|
||||||
(void)data;
|
(void)data;
|
||||||
(void)enable;
|
(void)enable;
|
||||||
@ -411,7 +411,7 @@ static bool apple_gfx_ctx_suppress_screensaver(void *data, bool enable)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool apple_gfx_ctx_has_windowed(void *data)
|
static bool cocoagl_gfx_ctx_has_windowed(void *data)
|
||||||
{
|
{
|
||||||
(void)data;
|
(void)data;
|
||||||
|
|
||||||
@ -422,7 +422,7 @@ static bool apple_gfx_ctx_has_windowed(void *data)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static void apple_gfx_ctx_swap_buffers(void *data)
|
static void cocoagl_gfx_ctx_swap_buffers(void *data)
|
||||||
{
|
{
|
||||||
if (!(--g_fast_forward_skips < 0))
|
if (!(--g_fast_forward_skips < 0))
|
||||||
return;
|
return;
|
||||||
@ -442,7 +442,7 @@ static void apple_gfx_ctx_swap_buffers(void *data)
|
|||||||
g_fast_forward_skips = g_is_syncing ? 0 : 3;
|
g_fast_forward_skips = g_is_syncing ? 0 : 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
static gfx_ctx_proc_t apple_gfx_ctx_get_proc_address(const char *symbol_name)
|
static gfx_ctx_proc_t cocoagl_gfx_ctx_get_proc_address(const char *symbol_name)
|
||||||
{
|
{
|
||||||
return (gfx_ctx_proc_t)CFBundleGetFunctionPointerForName(CFBundleGetBundleWithIdentifier(GLFrameworkID),
|
return (gfx_ctx_proc_t)CFBundleGetFunctionPointerForName(CFBundleGetBundleWithIdentifier(GLFrameworkID),
|
||||||
(
|
(
|
||||||
@ -455,7 +455,7 @@ CFStringRef)BOXSTRING(symbol_name)
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void apple_gfx_ctx_check_window(void *data, bool *quit,
|
static void cocoagl_gfx_ctx_check_window(void *data, bool *quit,
|
||||||
bool *resize, unsigned *width, unsigned *height, unsigned frame_count)
|
bool *resize, unsigned *width, unsigned *height, unsigned frame_count)
|
||||||
{
|
{
|
||||||
unsigned new_width, new_height;
|
unsigned new_width, new_height;
|
||||||
@ -463,7 +463,7 @@ static void apple_gfx_ctx_check_window(void *data, bool *quit,
|
|||||||
|
|
||||||
*quit = false;
|
*quit = false;
|
||||||
|
|
||||||
apple_gfx_ctx_get_video_size(data, &new_width, &new_height);
|
cocoagl_gfx_ctx_get_video_size(data, &new_width, &new_height);
|
||||||
if (new_width != *width || new_height != *height)
|
if (new_width != *width || new_height != *height)
|
||||||
{
|
{
|
||||||
*width = new_width;
|
*width = new_width;
|
||||||
@ -472,21 +472,21 @@ static void apple_gfx_ctx_check_window(void *data, bool *quit,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void apple_gfx_ctx_set_resize(void *data, unsigned width, unsigned height)
|
static void cocoagl_gfx_ctx_set_resize(void *data, unsigned width, unsigned height)
|
||||||
{
|
{
|
||||||
(void)data;
|
(void)data;
|
||||||
(void)width;
|
(void)width;
|
||||||
(void)height;
|
(void)height;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void apple_gfx_ctx_input_driver(void *data, const input_driver_t **input, void **input_data)
|
static void cocoagl_gfx_ctx_input_driver(void *data, const input_driver_t **input, void **input_data)
|
||||||
{
|
{
|
||||||
(void)data;
|
(void)data;
|
||||||
*input = NULL;
|
*input = NULL;
|
||||||
*input_data = NULL;
|
*input_data = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void apple_gfx_ctx_bind_hw_render(void *data, bool enable)
|
static void cocoagl_gfx_ctx_bind_hw_render(void *data, bool enable)
|
||||||
{
|
{
|
||||||
(void)data;
|
(void)data;
|
||||||
g_use_hw_ctx = enable;
|
g_use_hw_ctx = enable;
|
||||||
@ -497,30 +497,30 @@ static void apple_gfx_ctx_bind_hw_render(void *data, bool enable)
|
|||||||
[g_context makeCurrentContext];
|
[g_context makeCurrentContext];
|
||||||
}
|
}
|
||||||
|
|
||||||
const gfx_ctx_driver_t gfx_ctx_apple = {
|
const gfx_ctx_driver_t gfx_ctx_cocoagl = {
|
||||||
apple_gfx_ctx_init,
|
cocoagl_gfx_ctx_init,
|
||||||
apple_gfx_ctx_destroy,
|
cocoagl_gfx_ctx_destroy,
|
||||||
apple_gfx_ctx_bind_api,
|
cocoagl_gfx_ctx_bind_api,
|
||||||
apple_gfx_ctx_swap_interval,
|
cocoagl_gfx_ctx_swap_interval,
|
||||||
apple_gfx_ctx_set_video_mode,
|
cocoagl_gfx_ctx_set_video_mode,
|
||||||
apple_gfx_ctx_get_video_size,
|
cocoagl_gfx_ctx_get_video_size,
|
||||||
NULL, /* get_video_output_size */
|
NULL, /* get_video_output_size */
|
||||||
NULL, /* get_video_output_prev */
|
NULL, /* get_video_output_prev */
|
||||||
NULL, /* get_video_output_next */
|
NULL, /* get_video_output_next */
|
||||||
apple_gfx_ctx_get_metrics,
|
cocoagl_gfx_ctx_get_metrics,
|
||||||
NULL,
|
NULL,
|
||||||
apple_gfx_ctx_update_window_title,
|
cocoagl_gfx_ctx_update_window_title,
|
||||||
apple_gfx_ctx_check_window,
|
cocoagl_gfx_ctx_check_window,
|
||||||
apple_gfx_ctx_set_resize,
|
cocoagl_gfx_ctx_set_resize,
|
||||||
apple_gfx_ctx_has_focus,
|
cocoagl_gfx_ctx_has_focus,
|
||||||
apple_gfx_ctx_suppress_screensaver,
|
cocoagl_gfx_ctx_suppress_screensaver,
|
||||||
apple_gfx_ctx_has_windowed,
|
cocoagl_gfx_ctx_has_windowed,
|
||||||
apple_gfx_ctx_swap_buffers,
|
cocoagl_gfx_ctx_swap_buffers,
|
||||||
apple_gfx_ctx_input_driver,
|
cocoagl_gfx_ctx_input_driver,
|
||||||
apple_gfx_ctx_get_proc_address,
|
cocoagl_gfx_ctx_get_proc_address,
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
"apple",
|
"cocoagl",
|
||||||
apple_gfx_ctx_bind_hw_render,
|
cocoagl_gfx_ctx_bind_hw_render,
|
||||||
};
|
};
|
||||||
|
@ -60,7 +60,7 @@ static const gfx_ctx_driver_t *gfx_ctx_drivers[] = {
|
|||||||
&gfx_ctx_bbqnx,
|
&gfx_ctx_bbqnx,
|
||||||
#endif
|
#endif
|
||||||
#if defined(HAVE_COCOA) || defined(HAVE_COCOATOUCH)
|
#if defined(HAVE_COCOA) || defined(HAVE_COCOATOUCH)
|
||||||
&gfx_ctx_apple,
|
&gfx_ctx_cocoagl,
|
||||||
#endif
|
#endif
|
||||||
#if (defined(HAVE_SDL) || defined(HAVE_SDL2)) && defined(HAVE_OPENGL)
|
#if (defined(HAVE_SDL) || defined(HAVE_SDL2)) && defined(HAVE_OPENGL)
|
||||||
&gfx_ctx_sdl_gl,
|
&gfx_ctx_sdl_gl,
|
||||||
|
@ -163,7 +163,7 @@ extern const gfx_ctx_driver_t gfx_ctx_ps3;
|
|||||||
extern const gfx_ctx_driver_t gfx_ctx_wgl;
|
extern const gfx_ctx_driver_t gfx_ctx_wgl;
|
||||||
extern const gfx_ctx_driver_t gfx_ctx_videocore;
|
extern const gfx_ctx_driver_t gfx_ctx_videocore;
|
||||||
extern const gfx_ctx_driver_t gfx_ctx_bbqnx;
|
extern const gfx_ctx_driver_t gfx_ctx_bbqnx;
|
||||||
extern const gfx_ctx_driver_t gfx_ctx_apple;
|
extern const gfx_ctx_driver_t gfx_ctx_cocoagl;
|
||||||
extern const gfx_ctx_driver_t gfx_ctx_emscripten;
|
extern const gfx_ctx_driver_t gfx_ctx_emscripten;
|
||||||
extern const gfx_ctx_driver_t gfx_ctx_null;
|
extern const gfx_ctx_driver_t gfx_ctx_null;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user