mirror of
https://github.com/libretro/RetroArch
synced 2025-02-21 18:40:09 +00:00
(OSX) Start implementing apple_gfx_ctx_get_metrics - not yet iOS-compatible
This commit is contained in:
parent
69762dd339
commit
7781334c98
@ -24,6 +24,7 @@
|
|||||||
#include "../../general.h"
|
#include "../../general.h"
|
||||||
#include "../../runloop.h"
|
#include "../../runloop.h"
|
||||||
#include "../../frontend/frontend.h"
|
#include "../../frontend/frontend.h"
|
||||||
|
#include "../../gfx/video_context_driver.h"
|
||||||
|
|
||||||
#ifndef __has_feature
|
#ifndef __has_feature
|
||||||
/* Compatibility with non-Clang compilers. */
|
/* Compatibility with non-Clang compilers. */
|
||||||
@ -273,7 +274,7 @@ void apple_bind_game_view_fbo(void)
|
|||||||
static RAScreen* get_chosen_screen(void)
|
static RAScreen* get_chosen_screen(void)
|
||||||
{
|
{
|
||||||
#if defined(OSX) && !defined(MAC_OS_X_VERSION_10_6)
|
#if defined(OSX) && !defined(MAC_OS_X_VERSION_10_6)
|
||||||
return [NSScreen mainScreen];
|
return [RAScreen mainScreen];
|
||||||
#else
|
#else
|
||||||
settings_t *settings = config_get_ptr();
|
settings_t *settings = config_get_ptr();
|
||||||
if (settings->video.monitor_index >= RAScreen.screens.count)
|
if (settings->video.monitor_index >= RAScreen.screens.count)
|
||||||
@ -502,6 +503,38 @@ 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,
|
||||||
|
float *value)
|
||||||
|
{
|
||||||
|
#ifdef OSX
|
||||||
|
RAScreen *screen = [RAScreen mainScreen];
|
||||||
|
NSDictionary *description = [screen deviceDescription];
|
||||||
|
NSSize displayPixelSize = [[description objectForKey:NSDeviceSize] sizeValue];
|
||||||
|
CGSize displayPhysicalSize = CGDisplayScreenSize(
|
||||||
|
[[description objectForKey:@"NSScreenNumber"] unsignedIntValue]);
|
||||||
|
|
||||||
|
switch (type)
|
||||||
|
{
|
||||||
|
case DISPLAY_METRIC_NONE:
|
||||||
|
return false;
|
||||||
|
case DISPLAY_METRIC_MM_WIDTH:
|
||||||
|
*value = displayPhysicalSize.width;
|
||||||
|
break;
|
||||||
|
case DISPLAY_METRIC_MM_HEIGHT:
|
||||||
|
*value = displayPhysicalSize.height;
|
||||||
|
break;
|
||||||
|
case DISPLAY_METRIC_DPI:
|
||||||
|
/* 25.4 mm in an inch. */
|
||||||
|
*value = (displayPixelSize.width / displayPhysicalSize.width) * 25.4f;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
static bool apple_gfx_ctx_has_focus(void *data)
|
static bool apple_gfx_ctx_has_focus(void *data)
|
||||||
{
|
{
|
||||||
(void)data;
|
(void)data;
|
||||||
|
@ -40,6 +40,14 @@ enum gfx_ctx_api
|
|||||||
GFX_CTX_DIRECT3D9_API,
|
GFX_CTX_DIRECT3D9_API,
|
||||||
GFX_CTX_OPENVG_API
|
GFX_CTX_OPENVG_API
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum display_metric_types
|
||||||
|
{
|
||||||
|
DISPLAY_METRIC_NONE = 0,
|
||||||
|
DISPLAY_METRIC_MM_WIDTH,
|
||||||
|
DISPLAY_METRIC_MM_HEIGHT,
|
||||||
|
DISPLAY_METRIC_DPI,
|
||||||
|
};
|
||||||
|
|
||||||
typedef void (*gfx_ctx_proc_t)(void);
|
typedef void (*gfx_ctx_proc_t)(void);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user