(OSX/iOS) get_chosen_screen buildfixes
This commit is contained in:
parent
d3037ed839
commit
5fc267d24a
|
@ -120,7 +120,7 @@ void cocoagl_bind_game_view_fbo(void)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static RAScreen* get_chosen_screen(void)
|
void *get_chosen_screen(void)
|
||||||
{
|
{
|
||||||
#if defined(HAVE_COCOA) && !defined(MAC_OS_X_VERSION_10_6)
|
#if defined(HAVE_COCOA) && !defined(MAC_OS_X_VERSION_10_6)
|
||||||
return [RAScreen mainScreen];
|
return [RAScreen mainScreen];
|
||||||
|
@ -129,11 +129,11 @@ static RAScreen* get_chosen_screen(void)
|
||||||
if (settings->video.monitor_index >= RAScreen.screens.count)
|
if (settings->video.monitor_index >= RAScreen.screens.count)
|
||||||
{
|
{
|
||||||
RARCH_WARN("video_monitor_index is greater than the number of connected monitors; using main screen instead.\n");
|
RARCH_WARN("video_monitor_index is greater than the number of connected monitors; using main screen instead.\n");
|
||||||
return RAScreen.mainScreen;
|
return (__bridge void*)RAScreen.mainScreen;
|
||||||
}
|
}
|
||||||
|
|
||||||
NSArray *screens = [RAScreen screens];
|
NSArray *screens = [RAScreen screens];
|
||||||
return (RAScreen*)[screens objectAtIndex:settings->video.monitor_index];
|
return ((__bridge void*)[screens objectAtIndex:settings->video.monitor_index]);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -319,7 +319,7 @@ 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"));
|
||||||
RAScreen *screen = (RAScreen*)get_chosen_screen();
|
RAScreen *screen = (__bridge RAScreen*)get_chosen_screen();
|
||||||
|
|
||||||
if (ret != 0.0f)
|
if (ret != 0.0f)
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -337,7 +337,7 @@ float cocoagl_gfx_ctx_get_native_scale(void)
|
||||||
|
|
||||||
static void cocoagl_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 = (__bridge RAScreen*)get_chosen_screen();
|
||||||
CGRect size = screen.bounds;
|
CGRect size = screen.bounds;
|
||||||
float screenscale = cocoagl_gfx_ctx_get_native_scale();
|
float screenscale = cocoagl_gfx_ctx_get_native_scale();
|
||||||
|
|
||||||
|
@ -383,7 +383,7 @@ static void cocoagl_gfx_ctx_update_window_title(void *data)
|
||||||
static bool cocoagl_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)
|
||||||
{
|
{
|
||||||
RAScreen *screen = (RAScreen*)get_chosen_screen();
|
RAScreen *screen = (__bridge RAScreen*)get_chosen_screen();
|
||||||
#if defined(HAVE_COCOA)
|
#if defined(HAVE_COCOA)
|
||||||
NSDictionary *description = [screen deviceDescription];
|
NSDictionary *description = [screen deviceDescription];
|
||||||
NSSize display_pixel_size = [[description objectForKey:NSDeviceSize] sizeValue];
|
NSSize display_pixel_size = [[description objectForKey:NSDeviceSize] sizeValue];
|
||||||
|
|
|
@ -110,7 +110,7 @@ void *glkitview_init(void);
|
||||||
- (void)viewWillLayoutSubviews
|
- (void)viewWillLayoutSubviews
|
||||||
{
|
{
|
||||||
float width = 0.0f, height = 0.0f, tenpctw, tenpcth;
|
float width = 0.0f, height = 0.0f, tenpctw, tenpcth;
|
||||||
RAScreen *screen = (RAScreen*)get_chosen_screen();
|
RAScreen *screen = (__bridge RAScreen*)get_chosen_screen();
|
||||||
UIInterfaceOrientation orientation = self.interfaceOrientation;
|
UIInterfaceOrientation orientation = self.interfaceOrientation;
|
||||||
CGRect screenSize = [screen bounds];
|
CGRect screenSize = [screen bounds];
|
||||||
SEL selector = NSSelectorFromString(BOXSTRING("coordinateSpace"));
|
SEL selector = NSSelectorFromString(BOXSTRING("coordinateSpace"));
|
||||||
|
|
|
@ -31,6 +31,8 @@
|
||||||
|
|
||||||
static id apple_platform;
|
static id apple_platform;
|
||||||
|
|
||||||
|
void *get_chosen_screen(void);
|
||||||
|
|
||||||
void apple_rarch_exited(void)
|
void apple_rarch_exited(void)
|
||||||
{
|
{
|
||||||
[[NSApplication sharedApplication] terminate:nil];
|
[[NSApplication sharedApplication] terminate:nil];
|
||||||
|
@ -115,7 +117,7 @@ void apple_rarch_exited(void)
|
||||||
apple->mouse_rel_y = event.deltaY;
|
apple->mouse_rel_y = event.deltaY;
|
||||||
|
|
||||||
#if MAC_OS_X_VERSION_10_7
|
#if MAC_OS_X_VERSION_10_7
|
||||||
RAScreen *screen = [RAScreen mainScreen];
|
NSScreen *screen = (NSScreen*)get_chosen_screen();
|
||||||
CGFloat backing_scale_factor = screen.backingScaleFactor;
|
CGFloat backing_scale_factor = screen.backingScaleFactor;
|
||||||
#else
|
#else
|
||||||
CGFloat backing_scale_factor = 1.0f;
|
CGFloat backing_scale_factor = 1.0f;
|
||||||
|
|
Loading…
Reference in New Issue