mirror of
https://github.com/libretro/RetroArch
synced 2025-03-02 19:13:34 +00:00
Add OSX implementation for cocoagl_gfx_ctx_get_native_scale
This commit is contained in:
parent
7091e23254
commit
a408a5e59a
@ -299,7 +299,7 @@ static bool cocoagl_gfx_ctx_set_video_mode(void *data,
|
||||
|
||||
(void)data;
|
||||
|
||||
// TODO: Maybe iOS users should be able to show/hide the status bar here?
|
||||
/* TODO: Maybe iOS users should be able to show/hide the status bar here? */
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -326,12 +326,19 @@ float cocoagl_gfx_ctx_get_native_scale(void)
|
||||
if (!screen)
|
||||
return 0.0f;
|
||||
|
||||
#if TARGET_OS_IPHONE
|
||||
if ([screen respondsToSelector:selector])
|
||||
return cocoagl_gfx_ctx_get_scale_from_selector(screen, selector, &ret);
|
||||
#endif
|
||||
|
||||
ret = 1.0f;
|
||||
#if TARGET_OS_IPHONE
|
||||
if ([screen respondsToSelector:@selector(scale)])
|
||||
ret = screen.scale;
|
||||
#elif MAC_OS_X_VERSION_10_7
|
||||
if (screen.backingScaleFactor > 1.0f)
|
||||
ret = screen.backingScaleFactor;
|
||||
#endif
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -397,7 +404,7 @@ static bool cocoagl_gfx_ctx_get_metrics(void *data, enum display_metric_types ty
|
||||
#if MAC_OS_X_VERSION_10_7
|
||||
float scale = screen.backingScaleFactor;
|
||||
#else
|
||||
float scale = 1.0f;
|
||||
float scale = 1.0f;
|
||||
#endif
|
||||
float dpi = (display_width/ physical_width) * 25.4f * scale;
|
||||
#elif defined(HAVE_COCOATOUCH)
|
||||
|
@ -31,6 +31,8 @@
|
||||
|
||||
static id apple_platform;
|
||||
|
||||
extern float cocoagl_gfx_ctx_get_native_scale(void);
|
||||
|
||||
void apple_rarch_exited(void)
|
||||
{
|
||||
[[NSApplication sharedApplication] terminate:nil];
|
||||
@ -109,17 +111,12 @@ void apple_rarch_exited(void)
|
||||
case NSOtherMouseDragged:
|
||||
{
|
||||
NSPoint pos;
|
||||
NSPoint mouse_pos;
|
||||
NSPoint mouse_pos;
|
||||
CGFloat backing_scale_factor = cocoagl_gfx_ctx_get_native_scale();
|
||||
/* Relative */
|
||||
apple->mouse_rel_x = event.deltaX;
|
||||
apple->mouse_rel_y = event.deltaY;
|
||||
|
||||
#if MAC_OS_X_VERSION_10_7
|
||||
RAScreen *screen = [RAScreen mainScreen];
|
||||
CGFloat backing_scale_factor = screen.backingScaleFactor;
|
||||
#else
|
||||
CGFloat backing_scale_factor = 1.0f;
|
||||
#endif
|
||||
|
||||
/* Absolute */
|
||||
pos = [[CocoaView get] convertPoint:[event locationInWindow] fromView:nil];
|
||||
|
Loading…
x
Reference in New Issue
Block a user