mirror of
https://github.com/libretro/RetroArch
synced 2025-03-29 22:20:21 +00:00
(Menu) Start using menu_display_get_size
This commit is contained in:
parent
c13e99b71f
commit
c183f9dd11
@ -58,20 +58,22 @@ typedef struct glui_handle
|
||||
static void glui_blit_line(float x, float y,
|
||||
const char *message, uint32_t color, enum text_alignment text_align)
|
||||
{
|
||||
unsigned width, height;
|
||||
glui_handle_t *glui = NULL;
|
||||
menu_handle_t *menu = menu_driver_get_ptr();
|
||||
global_t *global = global_get_ptr();
|
||||
|
||||
if (!menu)
|
||||
return;
|
||||
|
||||
menu_display_get_size(&width, &height);
|
||||
|
||||
glui = (glui_handle_t*)menu->userdata;
|
||||
|
||||
struct font_params params = {0};
|
||||
|
||||
params.x = x / global->video_data.width;
|
||||
params.x = x / width;
|
||||
params.y = 1.0f - (y + glui->line_height/2 + menu->font.size/3)
|
||||
/ global->video_data.height;
|
||||
/ height;
|
||||
params.scale = 1.0;
|
||||
params.color = color;
|
||||
params.full_screen = true;
|
||||
@ -83,6 +85,7 @@ static void glui_blit_line(float x, float y,
|
||||
static void glui_render_quad(gl_t *gl, int x, int y, int w, int h,
|
||||
float r, float g, float b, float a)
|
||||
{
|
||||
unsigned width, height;
|
||||
struct gl_coords coords;
|
||||
menu_handle_t *menu = menu_driver_get_ptr();
|
||||
glui_handle_t *glui = (glui_handle_t*)menu->userdata;
|
||||
@ -106,9 +109,10 @@ static void glui_render_quad(gl_t *gl, int x, int y, int w, int h,
|
||||
r, g, b, a,
|
||||
r, g, b, a,
|
||||
};
|
||||
global_t *global = global_get_ptr();
|
||||
|
||||
glViewport(x, global->video_data.height - y - h, w, h);
|
||||
menu_display_get_size(&width, &height);
|
||||
|
||||
glViewport(x, height - y - h, w, h);
|
||||
|
||||
coords.vertices = 4;
|
||||
coords.vertex = vertex;
|
||||
@ -129,29 +133,31 @@ static void glui_draw_cursor(gl_t *gl, float x, float y)
|
||||
|
||||
static void glui_draw_scrollbar(gl_t *gl)
|
||||
{
|
||||
float content_height, total_height, height, y;
|
||||
int width = 4;
|
||||
unsigned width, height;
|
||||
float content_height, total_height, scrollbar_height, y;
|
||||
int scrollbar_width = 4;
|
||||
glui_handle_t *glui = NULL;
|
||||
menu_handle_t *menu = menu_driver_get_ptr();
|
||||
global_t *global = global_get_ptr();
|
||||
|
||||
if (!menu)
|
||||
return;
|
||||
|
||||
menu_display_get_size(&width, &height);
|
||||
|
||||
glui = (glui_handle_t*)menu->userdata;
|
||||
content_height = menu_entries_get_end() * glui->line_height;
|
||||
total_height = global->video_data.height - menu->header_height * 2;
|
||||
height = total_height / (content_height / total_height);
|
||||
total_height = height - menu->header_height * 2;
|
||||
scrollbar_height = total_height / (content_height / total_height);
|
||||
y = total_height * menu->scroll_y / content_height;
|
||||
|
||||
if (content_height < total_height)
|
||||
return;
|
||||
|
||||
glui_render_quad(gl,
|
||||
global->video_data.width - width,
|
||||
width - scrollbar_width,
|
||||
menu->header_height + y,
|
||||
width,
|
||||
height,
|
||||
scrollbar_width,
|
||||
scrollbar_height,
|
||||
1, 1, 1, 1);
|
||||
}
|
||||
|
||||
@ -175,12 +181,12 @@ static void glui_get_message(const char *message)
|
||||
static void glui_render_messagebox(const char *message)
|
||||
{
|
||||
unsigned i;
|
||||
unsigned width, height;
|
||||
uint32_t normal_color;
|
||||
int x, y;
|
||||
struct string_list *list = NULL;
|
||||
menu_handle_t *menu = menu_driver_get_ptr();
|
||||
settings_t *settings = config_get_ptr();
|
||||
global_t *global = global_get_ptr();
|
||||
|
||||
if (!menu || !menu->userdata)
|
||||
return;
|
||||
@ -193,8 +199,10 @@ static void glui_render_messagebox(const char *message)
|
||||
if (list->elems == 0)
|
||||
goto end;
|
||||
|
||||
x = global->video_data.width / 2;
|
||||
y = global->video_data.height / 2 - list->size * menu->font.size / 2;
|
||||
menu_display_get_size(&width, &height);
|
||||
|
||||
x = width / 2;
|
||||
y = height / 2 - list->size * menu->font.size / 2;
|
||||
|
||||
normal_color = FONT_COLOR_ARGB_TO_RGBA(settings->menu.entry_normal_color);
|
||||
|
||||
@ -212,20 +220,22 @@ end:
|
||||
static void glui_render(void)
|
||||
{
|
||||
int bottom;
|
||||
unsigned width, height;
|
||||
glui_handle_t *glui = NULL;
|
||||
menu_handle_t *menu = menu_driver_get_ptr();
|
||||
settings_t *settings = config_get_ptr();
|
||||
global_t *global = global_get_ptr();
|
||||
|
||||
if (!menu || !menu->userdata)
|
||||
return;
|
||||
|
||||
menu_display_get_size(&width, &height);
|
||||
|
||||
glui = (glui_handle_t*)menu->userdata;
|
||||
|
||||
menu_animation_update(menu->animation, menu->dt / IDEAL_DT);
|
||||
|
||||
menu->frame_buf.width = global->video_data.width;
|
||||
menu->frame_buf.height = global->video_data.height;
|
||||
menu->frame_buf.width = width;
|
||||
menu->frame_buf.height = height;
|
||||
|
||||
if (settings->menu.pointer.enable)
|
||||
{
|
||||
@ -254,12 +264,12 @@ static void glui_render(void)
|
||||
menu->scroll_y = 0;
|
||||
|
||||
bottom = menu_entries_get_end() * glui->line_height
|
||||
- global->video_data.height + menu->header_height * 2;
|
||||
- height + menu->header_height * 2;
|
||||
if (menu->scroll_y > bottom)
|
||||
menu->scroll_y = bottom;
|
||||
|
||||
if (menu_entries_get_end() * glui->line_height
|
||||
< global->video_data.height - menu->header_height*2)
|
||||
< height - menu->header_height*2)
|
||||
menu->scroll_y = 0;
|
||||
}
|
||||
|
||||
@ -268,14 +278,16 @@ static void glui_render_menu_list(runloop_t *runloop,
|
||||
uint32_t normal_color,
|
||||
uint32_t hover_color)
|
||||
{
|
||||
unsigned width, height;
|
||||
size_t i = 0;
|
||||
uint64_t frame_count = video_driver_get_frame_count();
|
||||
global_t *global = global_get_ptr();
|
||||
size_t end = menu_entries_get_end();
|
||||
|
||||
if (!menu_display_update_pending())
|
||||
return;
|
||||
|
||||
menu_display_get_size(&width, &height);
|
||||
|
||||
glui->list_block.carr.coords.vertices = 0;
|
||||
|
||||
for (i = 0; i < end; i++)
|
||||
@ -301,13 +313,14 @@ static void glui_render_menu_list(runloop_t *runloop,
|
||||
glui_blit_line(glui->margin, y, message,
|
||||
selected ? hover_color : normal_color, TEXT_ALIGN_LEFT);
|
||||
|
||||
glui_blit_line(global->video_data.width - glui->margin, y, type_str_buf,
|
||||
glui_blit_line(width - glui->margin, y, type_str_buf,
|
||||
selected ? hover_color : normal_color, TEXT_ALIGN_RIGHT);
|
||||
}
|
||||
}
|
||||
|
||||
static void glui_frame(void)
|
||||
{
|
||||
unsigned width, height;
|
||||
char title[PATH_MAX_LENGTH], title_buf[PATH_MAX_LENGTH],
|
||||
title_msg[PATH_MAX_LENGTH], timedate[PATH_MAX_LENGTH];
|
||||
gl_t *gl = NULL;
|
||||
@ -323,7 +336,6 @@ static void glui_frame(void)
|
||||
const uint32_t title_color = FONT_COLOR_ARGB_TO_RGBA(
|
||||
settings->menu.title_color);
|
||||
runloop_t *runloop = rarch_main_get_ptr();
|
||||
global_t *global = global_get_ptr();
|
||||
uint64_t frame_count = video_driver_get_frame_count();
|
||||
|
||||
if (!menu || !menu->userdata)
|
||||
@ -342,6 +354,8 @@ static void glui_frame(void)
|
||||
&& !glui->box_message[0])
|
||||
return;
|
||||
|
||||
menu_display_get_size(&width, &height);
|
||||
|
||||
menu_display_set_viewport();
|
||||
|
||||
gl_menu_frame_background(menu, settings, gl, glui->textures.bg.id, 0.75f, 0.75f, false);
|
||||
@ -360,17 +374,17 @@ static void glui_frame(void)
|
||||
glui_render_quad(gl, 0,
|
||||
menu->header_height - menu->scroll_y + glui->line_height *
|
||||
menu->navigation.selection_ptr,
|
||||
global->video_data.width, glui->line_height, 1, 1, 1, 0.1);
|
||||
width, glui->line_height, 1, 1, 1, 0.1);
|
||||
|
||||
menu->animation_is_active = true;
|
||||
menu->label.is_updated = false;
|
||||
|
||||
glui_render_quad(gl, 0, 0, global->video_data.width,
|
||||
glui_render_quad(gl, 0, 0, width,
|
||||
menu->header_height, 0.2, 0.2, 0.2, 1);
|
||||
|
||||
menu_animation_ticker_line(title_buf, glui->ticker_limit,
|
||||
frame_count / 100, title, true);
|
||||
glui_blit_line(global->video_data.width / 2, 0, title_buf,
|
||||
glui_blit_line(width / 2, 0, title_buf,
|
||||
title_color, TEXT_ALIGN_CENTER);
|
||||
|
||||
if (menu_entries_show_back())
|
||||
@ -378,8 +392,8 @@ static void glui_frame(void)
|
||||
title_color, TEXT_ALIGN_LEFT);
|
||||
|
||||
glui_render_quad(gl, 0,
|
||||
global->video_data.height - menu->header_height,
|
||||
global->video_data.width, menu->header_height,
|
||||
height - menu->header_height,
|
||||
width, menu->header_height,
|
||||
0.2, 0.2, 0.2, 1);
|
||||
|
||||
glui_draw_scrollbar(gl);
|
||||
@ -389,15 +403,15 @@ static void glui_frame(void)
|
||||
menu_entries_get_core_title(title_msg, sizeof(title_msg));
|
||||
|
||||
glui_blit_line(glui->margin,
|
||||
global->video_data.height - glui->line_height, title_msg,
|
||||
height - glui->line_height, title_msg,
|
||||
title_color, TEXT_ALIGN_LEFT);
|
||||
}
|
||||
|
||||
if (settings->menu.timedate_enable)
|
||||
{
|
||||
disp_timedate_set_label(timedate, sizeof(timedate), 0);
|
||||
glui_blit_line(global->video_data.width - glui->margin,
|
||||
global->video_data.height - glui->line_height, timedate, hover_color,
|
||||
glui_blit_line(width - glui->margin,
|
||||
height - glui->line_height, timedate, hover_color,
|
||||
TEXT_ALIGN_RIGHT);
|
||||
}
|
||||
|
||||
@ -407,14 +421,14 @@ static void glui_frame(void)
|
||||
const char *str = *menu->keyboard.buffer;
|
||||
if (!str)
|
||||
str = "";
|
||||
glui_render_quad(gl, 0, 0, global->video_data.width, global->video_data.height, 0, 0, 0, 0.75);
|
||||
glui_render_quad(gl, 0, 0, width, height, 0, 0, 0, 0.75);
|
||||
snprintf(msg, sizeof(msg), "%s\n%s", menu->keyboard.label, str);
|
||||
glui_render_messagebox(msg);
|
||||
}
|
||||
|
||||
if (glui->box_message[0] != '\0')
|
||||
{
|
||||
glui_render_quad(gl, 0, 0, global->video_data.width, global->video_data.height, 0, 0, 0, 0.75);
|
||||
glui_render_quad(gl, 0, 0, width, height, 0, 0, 0, 0.75);
|
||||
glui_render_messagebox(glui->box_message);
|
||||
glui->box_message[0] = '\0';
|
||||
}
|
||||
@ -566,15 +580,17 @@ static bool glui_load_wallpaper(void *data)
|
||||
static float glui_get_scroll(void)
|
||||
{
|
||||
int half;
|
||||
unsigned width, height;
|
||||
glui_handle_t *glui = NULL;
|
||||
menu_handle_t *menu = menu_driver_get_ptr();
|
||||
global_t *global = global_get_ptr();
|
||||
|
||||
if (!menu || !menu->userdata)
|
||||
return 0;
|
||||
|
||||
menu_display_get_size(&width, &height);
|
||||
|
||||
glui = (glui_handle_t*)menu->userdata;
|
||||
half = (global->video_data.height / glui->line_height) / 2;
|
||||
half = (height / glui->line_height) / 2;
|
||||
|
||||
if (menu->navigation.selection_ptr < half)
|
||||
return 0;
|
||||
|
@ -264,8 +264,8 @@ static void xmb_draw_icon(gl_t *gl, xmb_handle_t *xmb,
|
||||
float alpha, float rotation, float scale_factor)
|
||||
{
|
||||
struct gl_coords coords;
|
||||
unsigned width, height;
|
||||
math_matrix_4x4 mymat, mrot, mscal;
|
||||
global_t *global = global_get_ptr();
|
||||
|
||||
if (alpha > xmb->alpha)
|
||||
alpha = xmb->alpha;
|
||||
@ -273,11 +273,13 @@ static void xmb_draw_icon(gl_t *gl, xmb_handle_t *xmb,
|
||||
if (alpha == 0)
|
||||
return;
|
||||
|
||||
menu_display_get_size(&width, &height);
|
||||
|
||||
if (
|
||||
x < -xmb->icon.size/2 ||
|
||||
x > global->video_data.width ||
|
||||
x > width ||
|
||||
y < xmb->icon.size/2 ||
|
||||
y > global->video_data.height + xmb->icon.size)
|
||||
y > height + xmb->icon.size)
|
||||
return;
|
||||
|
||||
GLfloat color[] = {
|
||||
@ -287,7 +289,7 @@ static void xmb_draw_icon(gl_t *gl, xmb_handle_t *xmb,
|
||||
1.0f, 1.0f, 1.0f, alpha,
|
||||
};
|
||||
|
||||
glViewport(x, global->video_data.height - y, xmb->icon.size, xmb->icon.size);
|
||||
glViewport(x, height - y, xmb->icon.size, xmb->icon.size);
|
||||
|
||||
coords.vertices = 4;
|
||||
coords.vertex = rmb_vertex;
|
||||
@ -310,7 +312,7 @@ static void xmb_draw_icon_predone(gl_t *gl, xmb_handle_t *xmb,
|
||||
float alpha, float rotation, float scale_factor)
|
||||
{
|
||||
struct gl_coords coords;
|
||||
global_t *global = global_get_ptr();
|
||||
unsigned width, height;
|
||||
|
||||
if (alpha > xmb->alpha)
|
||||
alpha = xmb->alpha;
|
||||
@ -318,11 +320,13 @@ static void xmb_draw_icon_predone(gl_t *gl, xmb_handle_t *xmb,
|
||||
if (alpha == 0)
|
||||
return;
|
||||
|
||||
menu_display_get_size(&width, &height);
|
||||
|
||||
if (
|
||||
x < -xmb->icon.size/2 ||
|
||||
x > global->video_data.width ||
|
||||
x > width ||
|
||||
y < xmb->icon.size/2 ||
|
||||
y > global->video_data.height + xmb->icon.size)
|
||||
y > height + xmb->icon.size)
|
||||
return;
|
||||
|
||||
GLfloat color[] = {
|
||||
@ -335,7 +339,7 @@ static void xmb_draw_icon_predone(gl_t *gl, xmb_handle_t *xmb,
|
||||
if (gl->shader && gl->shader->use)
|
||||
gl->shader->use(gl, GL_SHADER_STOCK_BLEND);
|
||||
|
||||
glViewport(x, global->video_data.height - y, xmb->icon.size, xmb->icon.size);
|
||||
glViewport(x, height - y, xmb->icon.size, xmb->icon.size);
|
||||
|
||||
coords.vertices = 4;
|
||||
coords.vertex = rmb_vertex;
|
||||
@ -352,9 +356,9 @@ static void xmb_draw_text(menu_handle_t *menu,
|
||||
float y, float scale_factor, float alpha,
|
||||
enum text_alignment text_align)
|
||||
{
|
||||
unsigned width, height;
|
||||
uint8_t a8 = 0;
|
||||
struct font_params params = {0};
|
||||
global_t *global = global_get_ptr();
|
||||
|
||||
if (alpha > xmb->alpha)
|
||||
alpha = xmb->alpha;
|
||||
@ -364,12 +368,14 @@ static void xmb_draw_text(menu_handle_t *menu,
|
||||
if (a8 == 0)
|
||||
return;
|
||||
|
||||
if (x < -xmb->icon.size || x > global->video_data.width + xmb->icon.size
|
||||
|| y < -xmb->icon.size || y > global->video_data.height + xmb->icon.size)
|
||||
menu_display_get_size(&width, &height);
|
||||
|
||||
if (x < -xmb->icon.size || x > width + xmb->icon.size
|
||||
|| y < -xmb->icon.size || y > height + xmb->icon.size)
|
||||
return;
|
||||
|
||||
params.x = x / global->video_data.width;
|
||||
params.y = 1.0f - y / global->video_data.height;
|
||||
params.x = x / width;
|
||||
params.y = 1.0f - y / height;
|
||||
|
||||
params.scale = scale_factor;
|
||||
params.color = FONT_COLOR_RGBA(255, 255, 255, a8);
|
||||
@ -399,15 +405,17 @@ static void xmb_frame_messagebox(const char *message)
|
||||
{
|
||||
int x, y;
|
||||
unsigned i;
|
||||
unsigned width, height;
|
||||
struct string_list *list = NULL;
|
||||
gl_t *gl = NULL;
|
||||
xmb_handle_t *xmb = NULL;
|
||||
menu_handle_t *menu = menu_driver_get_ptr();
|
||||
global_t *global = global_get_ptr();
|
||||
|
||||
if (!menu)
|
||||
return;
|
||||
|
||||
menu_display_get_size(&width, &height);
|
||||
|
||||
xmb = (xmb_handle_t*)menu->userdata;
|
||||
|
||||
if (!xmb)
|
||||
@ -425,8 +433,8 @@ static void xmb_frame_messagebox(const char *message)
|
||||
if (list->elems == 0)
|
||||
goto end;
|
||||
|
||||
x = global->video_data.width / 2 - strlen(list->elems[0].data) * menu->font.size / 4;
|
||||
y = global->video_data.height / 2 - list->size * menu->font.size / 2;
|
||||
x = width / 2 - strlen(list->elems[0].data) * menu->font.size / 4;
|
||||
y = height / 2 - list->size * menu->font.size / 2;
|
||||
|
||||
for (i = 0; i < list->size; i++)
|
||||
{
|
||||
@ -577,7 +585,7 @@ static xmb_node_t *xmb_node_allocate_userdata(xmb_handle_t *xmb,
|
||||
{
|
||||
xmb_node_t *node = NULL;
|
||||
global_t *global = global_get_ptr();
|
||||
core_info_list_t *info_list = (core_info_list_t*)global->core_info;
|
||||
core_info_list_t *info_list = global ? (core_info_list_t*)global->core_info : NULL;
|
||||
|
||||
if (!info_list)
|
||||
return NULL;
|
||||
@ -622,7 +630,7 @@ static xmb_node_t* xmb_get_userdata_from_core(xmb_handle_t *xmb,
|
||||
core_info_t *info, unsigned i)
|
||||
{
|
||||
global_t *global = global_get_ptr();
|
||||
core_info_list_t *info_list = (core_info_list_t*)global->core_info;
|
||||
core_info_list_t *info_list = global ? (core_info_list_t*)global->core_info : NULL;
|
||||
|
||||
if (!info_list)
|
||||
return NULL;
|
||||
@ -721,14 +729,12 @@ static void xmb_set_title(xmb_handle_t *xmb)
|
||||
return;
|
||||
|
||||
if (menu->categories.selection_ptr == 0)
|
||||
{
|
||||
menu_entries_get_title(xmb->title_name, sizeof(xmb->title_name));
|
||||
}
|
||||
else
|
||||
{
|
||||
core_info_t *info = NULL;
|
||||
global_t *global = global_get_ptr();
|
||||
core_info_list_t *info_list = (core_info_list_t*)global->core_info;
|
||||
core_info_list_t *info_list = global ? (core_info_list_t*)global->core_info : NULL;
|
||||
|
||||
if (!info_list)
|
||||
return;
|
||||
@ -946,17 +952,19 @@ static void xmb_draw_items(xmb_handle_t *xmb, gl_t *gl,
|
||||
size_t current, size_t cat_selection_ptr)
|
||||
{
|
||||
unsigned i;
|
||||
unsigned width, height;
|
||||
math_matrix_4x4 mymat, mrot, mscal;
|
||||
core_info_t *info = NULL;
|
||||
const char *label = NULL;
|
||||
xmb_node_t *core_node = NULL;
|
||||
size_t end = 0;
|
||||
global_t *global = global_get_ptr();
|
||||
uint64_t frame_count = video_driver_get_frame_count();
|
||||
|
||||
if (!list || !list->size)
|
||||
return;
|
||||
|
||||
menu_display_get_size(&width, &height);
|
||||
|
||||
file_list_get_last(stack, NULL, &label, NULL);
|
||||
|
||||
if (cat_selection_ptr)
|
||||
@ -989,9 +997,9 @@ static void xmb_draw_items(xmb_handle_t *xmb, gl_t *gl,
|
||||
|
||||
if (
|
||||
icon_x < -xmb->icon.size / 2 ||
|
||||
icon_x > global->video_data.width ||
|
||||
icon_x > width ||
|
||||
icon_y < xmb->icon.size / 2 ||
|
||||
icon_y > global->video_data.height + xmb->icon.size)
|
||||
icon_y > height + xmb->icon.size)
|
||||
continue;
|
||||
|
||||
menu_entry_get(&entry, i, list, true);
|
||||
@ -1087,9 +1095,9 @@ static void xmb_draw_items(xmb_handle_t *xmb, gl_t *gl,
|
||||
|
||||
static void xmb_draw_cursor(gl_t *gl, xmb_handle_t *xmb, float x, float y)
|
||||
{
|
||||
unsigned width, height;
|
||||
struct gl_coords coords;
|
||||
math_matrix_4x4 mymat, mrot;
|
||||
global_t *global = global_get_ptr();
|
||||
|
||||
GLfloat color[] = {
|
||||
1.0f, 1.0f, 1.0f, xmb->alpha,
|
||||
@ -1098,7 +1106,9 @@ static void xmb_draw_cursor(gl_t *gl, xmb_handle_t *xmb, float x, float y)
|
||||
1.0f, 1.0f, 1.0f, xmb->alpha,
|
||||
};
|
||||
|
||||
glViewport(x, global->video_data.height - y, xmb->cursor.size, xmb->cursor.size);
|
||||
menu_display_get_size(&width, &height);
|
||||
|
||||
glViewport(x, height - y, xmb->cursor.size, xmb->cursor.size);
|
||||
|
||||
coords.vertices = 4;
|
||||
coords.vertex = rmb_vertex;
|
||||
@ -1165,6 +1175,7 @@ static void xmb_frame(void)
|
||||
{
|
||||
math_matrix_4x4 mymat, mrot, mscal;
|
||||
unsigned i, depth;
|
||||
unsigned width, height;
|
||||
char msg[PATH_MAX_LENGTH];
|
||||
char title_msg[PATH_MAX_LENGTH], timedate[PATH_MAX_LENGTH];
|
||||
bool render_background = false;
|
||||
@ -1173,7 +1184,6 @@ static void xmb_frame(void)
|
||||
const struct font_renderer *font_driver = NULL;
|
||||
menu_handle_t *menu = menu_driver_get_ptr();
|
||||
settings_t *settings = config_get_ptr();
|
||||
global_t *global = global_get_ptr();
|
||||
|
||||
if (!menu)
|
||||
return;
|
||||
@ -1188,6 +1198,8 @@ static void xmb_frame(void)
|
||||
if (!gl)
|
||||
return;
|
||||
|
||||
menu_display_get_size(&width, &height);
|
||||
|
||||
menu_display_font_bind_block(menu, font_driver, &xmb->raster_block);
|
||||
|
||||
xmb->raster_block.carr.coords.vertices = 0;
|
||||
@ -1203,7 +1215,7 @@ static void xmb_frame(void)
|
||||
disp_timedate_set_label(timedate, sizeof(timedate), 0);
|
||||
|
||||
xmb_draw_text(menu, xmb, timedate,
|
||||
global->video_data.width - xmb->margins.title.left - xmb->icon.size / 4,
|
||||
width - xmb->margins.title.left - xmb->icon.size / 4,
|
||||
xmb->margins.title.top, 1, 1, TEXT_ALIGN_RIGHT);
|
||||
}
|
||||
|
||||
@ -1211,7 +1223,7 @@ static void xmb_frame(void)
|
||||
{
|
||||
menu_entries_get_core_title(title_msg, sizeof(title_msg));
|
||||
xmb_draw_text(menu, xmb, title_msg, xmb->margins.title.left,
|
||||
global->video_data.height - xmb->margins.title.bottom, 1, 1, TEXT_ALIGN_LEFT);
|
||||
height - xmb->margins.title.bottom, 1, 1, TEXT_ALIGN_LEFT);
|
||||
}
|
||||
|
||||
depth = file_list_get_size(menu->menu_list->menu_stack);
|
||||
@ -1239,7 +1251,7 @@ static void xmb_frame(void)
|
||||
|
||||
if (settings->menu.timedate_enable)
|
||||
xmb_draw_icon_predone(gl, xmb, &mymat, xmb->textures.list[XMB_TEXTURE_CLOCK].id,
|
||||
global->video_data.width - xmb->icon.size, xmb->icon.size, 1, 0, 1);
|
||||
width - xmb->icon.size, xmb->icon.size, 1, 0, 1);
|
||||
|
||||
xmb_draw_icon_predone(gl, xmb, &mymat, xmb->textures.list[XMB_TEXTURE_ARROW].id,
|
||||
xmb->x + xmb->margins.screen.left +
|
||||
@ -1307,6 +1319,7 @@ static void xmb_frame(void)
|
||||
|
||||
static void *xmb_init(void)
|
||||
{
|
||||
unsigned width, height;
|
||||
menu_handle_t *menu = NULL;
|
||||
xmb_handle_t *xmb = NULL;
|
||||
const video_driver_t *video_driver = NULL;
|
||||
@ -1326,6 +1339,8 @@ static void *xmb_init(void)
|
||||
if (!menu)
|
||||
goto error;
|
||||
|
||||
menu_display_get_size(&width, &height);
|
||||
|
||||
menu->userdata = (xmb_handle_t*)calloc(1, sizeof(xmb_handle_t));
|
||||
|
||||
if (!menu->userdata)
|
||||
@ -1368,20 +1383,20 @@ static void *xmb_init(void)
|
||||
xmb->item.active.factor = 3.0;
|
||||
xmb->under_offset.item = 5.0;
|
||||
|
||||
menu->frame_buf.width = global->video_data.width;
|
||||
menu->frame_buf.height = global->video_data.height;
|
||||
menu->frame_buf.width = width;
|
||||
menu->frame_buf.height = height;
|
||||
|
||||
if (global->video_data.width >= 3840)
|
||||
if (width >= 3840)
|
||||
scale_factor = 2.0;
|
||||
else if (global->video_data.width >= 2560)
|
||||
else if (width >= 2560)
|
||||
scale_factor = 1.5;
|
||||
else if (global->video_data.width >= 1920)
|
||||
else if (width >= 1920)
|
||||
scale_factor = 1.0;
|
||||
else if (global->video_data.width >= 1280)
|
||||
else if (width >= 1280)
|
||||
scale_factor = 0.75;
|
||||
else if (global->video_data.width >= 640)
|
||||
else if (width >= 640)
|
||||
scale_factor = 0.5;
|
||||
else if (global->video_data.width >= 320)
|
||||
else if (width >= 320)
|
||||
scale_factor = 0.25;
|
||||
|
||||
strlcpy(xmb->icon.dir, "256", sizeof(xmb->icon.dir));
|
||||
@ -1604,7 +1619,7 @@ static void xmb_context_reset(void)
|
||||
xmb->settings_node.alpha = xmb->categories.active.alpha;
|
||||
xmb->settings_node.zoom = xmb->categories.active.zoom;
|
||||
|
||||
info_list = (core_info_list_t*)global->core_info;
|
||||
info_list = global ? (core_info_list_t*)global->core_info : NULL;
|
||||
|
||||
if (!info_list)
|
||||
return;
|
||||
|
@ -219,18 +219,28 @@ bool menu_display_init_main_font(menu_handle_t *menu,
|
||||
return result;
|
||||
}
|
||||
|
||||
void menu_display_set_viewport(void)
|
||||
void menu_display_get_size(unsigned *width, unsigned *height)
|
||||
{
|
||||
global_t *global = global_get_ptr();
|
||||
if (width)
|
||||
*width = global->video_data.width;
|
||||
if (height)
|
||||
*height = global->video_data.height;
|
||||
}
|
||||
|
||||
video_driver_set_viewport(global->video_data.width,
|
||||
global->video_data.height, true, false);
|
||||
void menu_display_set_viewport(void)
|
||||
{
|
||||
unsigned width, height;
|
||||
menu_display_get_size(&width, &height);
|
||||
|
||||
video_driver_set_viewport(width, height, true, false);
|
||||
}
|
||||
|
||||
void menu_display_unset_viewport(void)
|
||||
{
|
||||
global_t *global = global_get_ptr();
|
||||
unsigned width, height;
|
||||
menu_display_get_size(&width, &height);
|
||||
|
||||
video_driver_set_viewport(global->video_data.width,
|
||||
global->video_data.height, false, true);
|
||||
video_driver_set_viewport(width,
|
||||
height, false, true);
|
||||
}
|
||||
|
@ -56,6 +56,8 @@ bool menu_display_init_main_font(menu_handle_t *menu,
|
||||
const char *font_path, float font_size);
|
||||
void menu_display_free_main_font(menu_handle_t *menu);
|
||||
|
||||
void menu_display_get_size(unsigned *width, unsigned *height);
|
||||
|
||||
void menu_display_set_viewport(void);
|
||||
|
||||
void menu_display_unset_viewport(void);
|
||||
|
Loading…
x
Reference in New Issue
Block a user