(GLUI) Use dpi on mobile platforms only. For desktop, remain proportional to screen width like XMB.

This commit is contained in:
Jean-André Santoni 2015-07-07 01:36:53 +07:00
parent aec9bbc9f5
commit 457ffd3dd8
1 changed files with 13 additions and 6 deletions

View File

@ -514,21 +514,28 @@ static void glui_allocate_white_texture(glui_handle_t *glui)
static void glui_layout(menu_handle_t *menu, glui_handle_t *glui) static void glui_layout(menu_handle_t *menu, glui_handle_t *glui)
{ {
float scale_factor; float scale_factor, glyph_width;
unsigned width, height; unsigned width, height;
settings_t *settings = config_get_ptr(); settings_t *settings = config_get_ptr();
video_driver_get_size(&width, &height); video_driver_get_size(&width, &height);
if (settings->video.fullscreen) /* Mobiles platforms may have very small display metrics coupled to a high
scale_factor = menu_display_get_dpi(); resolution, so we should be dpi aware to ensure the entries hitboxes are big
else enough. On desktops, we just care about readability, with every widget size
scale_factor = width / 6; proportional to the display width. */
#ifdef RARCH_MOBILE
scale_factor = menu_display_get_dpi();
#else
scale_factor = width * 256 / 1920;
#endif
glui->line_height = scale_factor / 3; glui->line_height = scale_factor / 3;
glui->margin = scale_factor / 6; glui->margin = scale_factor / 6;
glui->ticker_limit = scale_factor / 3;
menu->display.header_height = scale_factor / 3; menu->display.header_height = scale_factor / 3;
menu->display.font.size = scale_factor / 8; menu->display.font.size = scale_factor / 8;
/* we assume the average glyph aspect ratio is close to 3:4 */
glyph_width = menu->display.font.size * 3/4;
glui->ticker_limit = (width/2) / glyph_width;
} }
static void *glui_init(void) static void *glui_init(void)