mirror of
https://github.com/libretro/RetroArch.git
synced 2024-12-17 22:29:27 +00:00
(Menu) Start getting rid of gl->win_width/gl->win_height and start
creating global->video_data.width and global->video_data.height which should be used instead in menu drivers
This commit is contained in:
parent
36c2786864
commit
b6fbf5a335
@ -576,6 +576,7 @@ static void gl_init_fbo(gl_t *gl, unsigned width, unsigned height)
|
||||
{
|
||||
int i;
|
||||
struct gfx_fbo_scale scale, scale_last;
|
||||
global_t *global = global_get_ptr();
|
||||
|
||||
if (!gl || gl->shader->num_shaders() == 0)
|
||||
return;
|
||||
@ -620,7 +621,7 @@ static void gl_init_fbo(gl_t *gl, unsigned width, unsigned height)
|
||||
}
|
||||
}
|
||||
|
||||
gl_compute_fbo_geometry(gl, width, height, gl->win_width, gl->win_height);
|
||||
gl_compute_fbo_geometry(gl, width, height, global->video_data.width, global->video_data.height);
|
||||
|
||||
for (i = 0; i < gl->fbo_pass; i++)
|
||||
{
|
||||
@ -800,7 +801,7 @@ void gl_set_viewport(gl_t *gl, unsigned width,
|
||||
|
||||
/* GL has bottom-left origin viewport. */
|
||||
x = custom->x;
|
||||
y = gl->win_height - custom->y - custom->height;
|
||||
y = global->video_data.height - custom->y - custom->height;
|
||||
width = custom->width;
|
||||
height = custom->height;
|
||||
}
|
||||
@ -969,6 +970,7 @@ static void gl_frame_fbo(gl_t *gl,
|
||||
unsigned fbo_tex_info_cnt = 0;
|
||||
GLfloat fbo_tex_coords[8] = {0.0f};
|
||||
runloop_t *runloop = rarch_main_get_ptr();
|
||||
global_t *global = global_get_ptr();
|
||||
|
||||
/* Render the rest of our passes. */
|
||||
gl->coords.tex_coord = fbo_tex_coords;
|
||||
@ -1050,7 +1052,7 @@ static void gl_frame_fbo(gl_t *gl,
|
||||
glGenerateMipmap(GL_TEXTURE_2D);
|
||||
|
||||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
gl_set_viewport(gl, gl->win_width, gl->win_height, false, true);
|
||||
gl_set_viewport(gl, global->video_data.width, global->video_data.height, false, true);
|
||||
|
||||
gl->shader->set_params(gl,
|
||||
prev_rect->img_width, prev_rect->img_height,
|
||||
@ -1397,8 +1399,10 @@ static INLINE void gl_set_prev_texture(gl_t *gl,
|
||||
|
||||
static INLINE void gl_set_shader_viewport(gl_t *gl, unsigned shader)
|
||||
{
|
||||
global_t *global = global_get_ptr();
|
||||
|
||||
gl->shader->use(gl, shader);
|
||||
gl_set_viewport(gl, gl->win_width, gl->win_height, false, true);
|
||||
gl_set_viewport(gl, global->video_data.width, global->video_data.height, false, true);
|
||||
}
|
||||
|
||||
#if defined(HAVE_GL_ASYNC_READBACK) && defined(HAVE_MENU)
|
||||
@ -1443,6 +1447,7 @@ static INLINE void gl_draw_texture(gl_t *gl)
|
||||
1.0f, 1.0f, 1.0f, gl->menu_texture_alpha,
|
||||
1.0f, 1.0f, 1.0f, gl->menu_texture_alpha,
|
||||
};
|
||||
global_t *global = global_get_ptr();
|
||||
if (!gl->menu_texture)
|
||||
return;
|
||||
|
||||
@ -1460,7 +1465,7 @@ static INLINE void gl_draw_texture(gl_t *gl)
|
||||
|
||||
if (gl->menu_texture_full_screen)
|
||||
{
|
||||
glViewport(0, 0, gl->win_width, gl->win_height);
|
||||
glViewport(0, 0, global->video_data.width, global->video_data.height);
|
||||
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
|
||||
glViewport(gl->vp.x, gl->vp.y, gl->vp.width, gl->vp.height);
|
||||
}
|
||||
@ -1482,6 +1487,7 @@ static bool gl_frame(void *data, const void *frame,
|
||||
runloop_t *runloop = rarch_main_get_ptr();
|
||||
driver_t *driver = driver_get_ptr();
|
||||
settings_t *settings = config_get_ptr();
|
||||
global_t *global = global_get_ptr();
|
||||
const struct font_renderer *font_driver = driver ? driver->font_osd_driver : NULL;
|
||||
|
||||
RARCH_PERFORMANCE_INIT(frame_run);
|
||||
@ -1498,7 +1504,7 @@ static bool gl_frame(void *data, const void *frame,
|
||||
|
||||
#ifdef IOS
|
||||
/* Apparently the viewport is lost each frame, thanks Apple. */
|
||||
gl_set_viewport(gl, gl->win_width, gl->win_height, false, true);
|
||||
gl_set_viewport(gl, global->video_data.width, global->video_data.height, false, true);
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_FBO
|
||||
@ -1515,7 +1521,7 @@ static bool gl_frame(void *data, const void *frame,
|
||||
{
|
||||
gl->should_resize = false;
|
||||
|
||||
gfx_ctx_set_resize(gl, gl->win_width, gl->win_height);
|
||||
gfx_ctx_set_resize(gl, global->video_data.width, global->video_data.height);
|
||||
|
||||
#ifdef HAVE_FBO
|
||||
if (gl->fbo_inited)
|
||||
@ -1528,7 +1534,7 @@ static bool gl_frame(void *data, const void *frame,
|
||||
}
|
||||
else
|
||||
#endif
|
||||
gl_set_viewport(gl, gl->win_width, gl->win_height, false, true);
|
||||
gl_set_viewport(gl, global->video_data.width, global->video_data.height, false, true);
|
||||
}
|
||||
|
||||
gl->tex_index = frame ?
|
||||
@ -1561,7 +1567,7 @@ static bool gl_frame(void *data, const void *frame,
|
||||
if (!gl->fbo_inited)
|
||||
{
|
||||
gl_bind_backbuffer();
|
||||
gl_set_viewport(gl, gl->win_width, gl->win_height, false, true);
|
||||
gl_set_viewport(gl, global->video_data.width, global->video_data.height, false, true);
|
||||
}
|
||||
|
||||
#ifndef HAVE_OPENGLES
|
||||
@ -2288,14 +2294,14 @@ static void *gl_init(const video_info_t *video, const input_driver_t **input, vo
|
||||
gl->fullscreen = video->fullscreen;
|
||||
|
||||
/* Get real known video size, which might have been altered by context. */
|
||||
gfx_ctx_get_video_size(gl, &gl->win_width, &gl->win_height);
|
||||
RARCH_LOG("GL: Using resolution %ux%u\n", gl->win_width, gl->win_height);
|
||||
gfx_ctx_get_video_size(gl, &global->video_data.width, &global->video_data.height);
|
||||
RARCH_LOG("GL: Using resolution %ux%u\n", global->video_data.width, global->video_data.height);
|
||||
|
||||
if (gl->full_x || gl->full_y)
|
||||
{
|
||||
/* We got bogus from gfx_ctx_get_video_size. Replace. */
|
||||
gl->full_x = gl->win_width;
|
||||
gl->full_y = gl->win_height;
|
||||
gl->full_x = global->video_data.width;
|
||||
gl->full_y = global->video_data.height;
|
||||
}
|
||||
|
||||
hw_render = &global->system.hw_render_callback;
|
||||
@ -2445,10 +2451,11 @@ error:
|
||||
static bool gl_alive(void *data)
|
||||
{
|
||||
bool quit = false, resize = false;
|
||||
gl_t *gl = (gl_t*)data;
|
||||
gl_t *gl = (gl_t*)data;
|
||||
global_t *global = global_get_ptr();
|
||||
|
||||
if (!gfx_ctx_check_window(data, &quit,
|
||||
&resize, &gl->win_width, &gl->win_height))
|
||||
&resize, &global->video_data.width, &global->video_data.height))
|
||||
return false;
|
||||
|
||||
if (quit)
|
||||
@ -2630,15 +2637,16 @@ static bool gl_set_shader(void *data,
|
||||
static void gl_viewport_info(void *data, struct video_viewport *vp)
|
||||
{
|
||||
unsigned top_y, top_dist;
|
||||
gl_t *gl = (gl_t*)data;
|
||||
gl_t *gl = (gl_t*)data;
|
||||
global_t *global = global_get_ptr();
|
||||
|
||||
*vp = gl->vp;
|
||||
vp->full_width = gl->win_width;
|
||||
vp->full_height = gl->win_height;
|
||||
vp->full_width = global->video_data.width;
|
||||
vp->full_height = global->video_data.height;
|
||||
|
||||
/* Adjust as GL viewport is bottom-up. */
|
||||
top_y = vp->y + vp->height;
|
||||
top_dist = gl->win_height - top_y;
|
||||
top_dist = global->video_data.height - top_y;
|
||||
vp->y = top_dist;
|
||||
}
|
||||
|
||||
@ -2975,6 +2983,7 @@ static void gl_overlay_set_alpha(void *data, unsigned image, float mod)
|
||||
static void gl_render_overlay(void *data)
|
||||
{
|
||||
unsigned i;
|
||||
global_t *global = global_get_ptr();
|
||||
gl_t *gl = (gl_t*)data;
|
||||
if (!gl)
|
||||
return;
|
||||
@ -2982,7 +2991,8 @@ static void gl_render_overlay(void *data)
|
||||
glEnable(GL_BLEND);
|
||||
|
||||
if (gl->overlay_full_screen)
|
||||
glViewport(0, 0, gl->win_width, gl->win_height);
|
||||
glViewport(0, 0,
|
||||
global->video_data.width, global->video_data.height);
|
||||
|
||||
/* Ensure that we reset the attrib array. */
|
||||
gl->shader->use(gl, GL_SHADER_STOCK_BLEND);
|
||||
|
@ -292,8 +292,6 @@ typedef struct gl
|
||||
|
||||
unsigned full_x, full_y;
|
||||
|
||||
unsigned win_width;
|
||||
unsigned win_height;
|
||||
struct video_viewport vp;
|
||||
unsigned vp_out_width;
|
||||
unsigned vp_out_height;
|
||||
|
@ -257,12 +257,13 @@ static void gl_raster_font_render_message(
|
||||
|
||||
static void gl_raster_font_setup_viewport(gl_raster_t *font, bool full_screen)
|
||||
{
|
||||
gl_t *gl = font->gl;
|
||||
gl_t *gl = font->gl;
|
||||
global_t *global = global_get_ptr();
|
||||
|
||||
if (!gl)
|
||||
return;
|
||||
|
||||
gl_set_viewport(gl, gl->win_width, gl->win_height, full_screen, false);
|
||||
gl_set_viewport(gl, global->video_data.width, global->video_data.height, full_screen, false);
|
||||
|
||||
glEnable(GL_BLEND);
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
@ -276,10 +277,12 @@ static void gl_raster_font_setup_viewport(gl_raster_t *font, bool full_screen)
|
||||
|
||||
static void gl_raster_font_restore_viewport(gl_t *gl)
|
||||
{
|
||||
global_t *global = global_get_ptr();
|
||||
|
||||
glBindTexture(GL_TEXTURE_2D, gl->texture[gl->tex_index]);
|
||||
|
||||
glDisable(GL_BLEND);
|
||||
gl_set_viewport(gl, gl->win_width, gl->win_height, false, true);
|
||||
gl_set_viewport(gl, global->video_data.width, global->video_data.height, false, true);
|
||||
}
|
||||
|
||||
static void gl_raster_font_render_msg(void *data, const char *msg,
|
||||
|
@ -86,6 +86,7 @@ static void glui_blit_line(gl_t *gl, float x, float y,
|
||||
{
|
||||
glui_handle_t *glui = NULL;
|
||||
menu_handle_t *menu = menu_driver_get_ptr();
|
||||
global_t *global = global_get_ptr();
|
||||
|
||||
if (!menu)
|
||||
return;
|
||||
@ -94,9 +95,9 @@ static void glui_blit_line(gl_t *gl, float x, float y,
|
||||
|
||||
struct font_params params = {0};
|
||||
|
||||
params.x = x / gl->win_width;
|
||||
params.x = x / global->video_data.width;
|
||||
params.y = 1.0f - (y + glui->line_height/2 + menu->font.size/3)
|
||||
/ gl->win_height;
|
||||
/ global->video_data.height;
|
||||
params.scale = 1.0;
|
||||
params.color = color;
|
||||
params.full_screen = true;
|
||||
@ -138,7 +139,7 @@ static void glui_render_background(settings_t *settings, gl_t *gl,
|
||||
};
|
||||
global_t *global = global_get_ptr();
|
||||
|
||||
glViewport(0, 0, gl->win_width, gl->win_height);
|
||||
glViewport(0, 0, global->video_data.width, global->video_data.height);
|
||||
|
||||
coords.vertices = 4;
|
||||
coords.vertex = vertex;
|
||||
@ -171,6 +172,7 @@ static void glui_render_background(settings_t *settings, gl_t *gl,
|
||||
static void glui_render_quad(gl_t *gl, int x, int y, int w, int h,
|
||||
float r, float g, float b, float a)
|
||||
{
|
||||
struct gl_coords coords;
|
||||
static const GLfloat vertex[] = {
|
||||
0, 0,
|
||||
1, 0,
|
||||
@ -185,16 +187,15 @@ static void glui_render_quad(gl_t *gl, int x, int y, int w, int h,
|
||||
1, 0,
|
||||
};
|
||||
|
||||
struct gl_coords coords;
|
||||
|
||||
GLfloat color[] = {
|
||||
r, g, b, a,
|
||||
r, g, b, a,
|
||||
r, g, b, a,
|
||||
r, g, b, a,
|
||||
};
|
||||
global_t *global = global_get_ptr();
|
||||
|
||||
glViewport(x, gl->win_height - y - h, w, h);
|
||||
glViewport(x, global->video_data.height - y - h, w, h);
|
||||
|
||||
coords.vertices = 4;
|
||||
coords.vertex = vertex;
|
||||
@ -225,6 +226,7 @@ static void glui_draw_scrollbar(gl_t *gl)
|
||||
int width = 4;
|
||||
glui_handle_t *glui = NULL;
|
||||
menu_handle_t *menu = menu_driver_get_ptr();
|
||||
global_t *global = global_get_ptr();
|
||||
|
||||
if (!menu)
|
||||
return;
|
||||
@ -232,7 +234,7 @@ static void glui_draw_scrollbar(gl_t *gl)
|
||||
glui = (glui_handle_t*)menu->userdata;
|
||||
content_height = menu_list_get_size(menu->menu_list)
|
||||
* glui->line_height;
|
||||
total_height = gl->win_height - menu->header_height * 2;
|
||||
total_height = global->video_data.height - menu->header_height * 2;
|
||||
height = total_height / (content_height / total_height);
|
||||
y = total_height * menu->scroll_y / content_height;
|
||||
|
||||
@ -240,7 +242,7 @@ static void glui_draw_scrollbar(gl_t *gl)
|
||||
return;
|
||||
|
||||
glui_render_quad(gl,
|
||||
gl->win_width - width,
|
||||
global->video_data.width - width,
|
||||
menu->header_height + y,
|
||||
width,
|
||||
height,
|
||||
@ -274,6 +276,7 @@ static void glui_render_messagebox(const char *message)
|
||||
gl_t *gl = NULL;
|
||||
menu_handle_t *menu = menu_driver_get_ptr();
|
||||
settings_t *settings = config_get_ptr();
|
||||
global_t *global = global_get_ptr();
|
||||
|
||||
if (!menu)
|
||||
return;
|
||||
@ -296,8 +299,8 @@ static void glui_render_messagebox(const char *message)
|
||||
if (list->elems == 0)
|
||||
goto end;
|
||||
|
||||
x = gl->win_width / 2;
|
||||
y = gl->win_height / 2 - list->size * menu->font.size / 2;
|
||||
x = global->video_data.width / 2;
|
||||
y = global->video_data.height / 2 - list->size * menu->font.size / 2;
|
||||
|
||||
normal_color = FONT_COLOR_ARGB_TO_RGBA(settings->menu.entry_normal_color);
|
||||
|
||||
@ -319,6 +322,7 @@ static void glui_render(void)
|
||||
gl_t *gl = NULL;
|
||||
menu_handle_t *menu = menu_driver_get_ptr();
|
||||
settings_t *settings = config_get_ptr();
|
||||
global_t *global = global_get_ptr();
|
||||
|
||||
if (!menu)
|
||||
return;
|
||||
@ -335,8 +339,8 @@ static void glui_render(void)
|
||||
|
||||
menu_animation_update(menu->animation, menu->dt / IDEAL_DT);
|
||||
|
||||
menu->frame_buf.width = gl->win_width;
|
||||
menu->frame_buf.height = gl->win_height;
|
||||
menu->frame_buf.width = global->video_data.width;
|
||||
menu->frame_buf.height = global->video_data.height;
|
||||
|
||||
if (settings->menu.pointer.enable)
|
||||
{
|
||||
@ -365,12 +369,12 @@ static void glui_render(void)
|
||||
menu->scroll_y = 0;
|
||||
|
||||
bottom = menu_list_get_size(menu->menu_list) * glui->line_height
|
||||
- gl->win_height + menu->header_height * 2;
|
||||
- global->video_data.height + menu->header_height * 2;
|
||||
if (menu->scroll_y > bottom)
|
||||
menu->scroll_y = bottom;
|
||||
|
||||
if (menu_list_get_size(menu->menu_list) * glui->line_height
|
||||
< gl->win_height - menu->header_height*2)
|
||||
< global->video_data.height - menu->header_height*2)
|
||||
menu->scroll_y = 0;
|
||||
}
|
||||
|
||||
@ -380,6 +384,7 @@ static void glui_render_menu_list(runloop_t *runloop,
|
||||
uint32_t hover_color)
|
||||
{
|
||||
size_t i = 0;
|
||||
global_t *global = global_get_ptr();
|
||||
|
||||
if (!menu_display_update_pending())
|
||||
return;
|
||||
@ -425,7 +430,7 @@ static void glui_render_menu_list(runloop_t *runloop,
|
||||
glui_blit_line(gl, glui->margin, y, message,
|
||||
selected ? hover_color : normal_color, TEXT_ALIGN_LEFT);
|
||||
|
||||
glui_blit_line(gl, gl->win_width - glui->margin, y, type_str_buf,
|
||||
glui_blit_line(gl, global->video_data.width - glui->margin, y, type_str_buf,
|
||||
selected ? hover_color : normal_color, TEXT_ALIGN_RIGHT);
|
||||
}
|
||||
}
|
||||
@ -472,7 +477,7 @@ static void glui_frame(void)
|
||||
&& !menu->msg_force)
|
||||
return;
|
||||
|
||||
gl_set_viewport(gl, gl->win_width, gl->win_height, true, false);
|
||||
gl_set_viewport(gl, global->video_data.width, global->video_data.height, true, false);
|
||||
|
||||
glui_render_background(settings, gl, glui);
|
||||
|
||||
@ -483,7 +488,7 @@ static void glui_frame(void)
|
||||
glui_render_quad(gl, 0,
|
||||
menu->header_height - menu->scroll_y + glui->line_height *
|
||||
menu->navigation.selection_ptr,
|
||||
gl->win_width, glui->line_height, 1, 1, 1, 0.1);
|
||||
global->video_data.width, glui->line_height, 1, 1, 1, 0.1);
|
||||
|
||||
font_driver = driver->font_osd_driver;
|
||||
|
||||
@ -498,12 +503,12 @@ static void glui_frame(void)
|
||||
runloop->frames.video.current.menu.label.is_updated = false;
|
||||
runloop->frames.video.current.menu.framebuf.dirty = false;
|
||||
|
||||
glui_render_quad(gl, 0, 0, gl->win_width,
|
||||
glui_render_quad(gl, 0, 0, global->video_data.width,
|
||||
menu->header_height, 0.2, 0.2, 0.2, 1);
|
||||
|
||||
menu_animation_ticker_line(title_buf, glui->ticker_limit,
|
||||
runloop->frames.video.count / 100, title, true);
|
||||
glui_blit_line(gl, gl->win_width/2, 0, title_buf,
|
||||
glui_blit_line(gl, global->video_data.width / 2, 0, title_buf,
|
||||
title_color, TEXT_ALIGN_CENTER);
|
||||
|
||||
if (file_list_get_size(menu->menu_list->menu_stack) > 1)
|
||||
@ -511,8 +516,8 @@ static void glui_frame(void)
|
||||
title_color, TEXT_ALIGN_LEFT);
|
||||
|
||||
glui_render_quad(gl, 0,
|
||||
gl->win_height - menu->header_height,
|
||||
gl->win_width, menu->header_height,
|
||||
global->video_data.height - menu->header_height,
|
||||
global->video_data.width, menu->header_height,
|
||||
0.2, 0.2, 0.2, 1);
|
||||
|
||||
glui_draw_scrollbar(gl);
|
||||
@ -536,15 +541,15 @@ static void glui_frame(void)
|
||||
core_name, core_version);
|
||||
|
||||
glui_blit_line(gl, glui->margin,
|
||||
gl->win_height - glui->line_height, title_msg,
|
||||
global->video_data.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(gl, gl->win_width - glui->margin,
|
||||
gl->win_height - glui->line_height, timedate, hover_color,
|
||||
glui_blit_line(gl, global->video_data.width - glui->margin,
|
||||
global->video_data.height - glui->line_height, timedate, hover_color,
|
||||
TEXT_ALIGN_RIGHT);
|
||||
}
|
||||
|
||||
@ -554,14 +559,14 @@ static void glui_frame(void)
|
||||
const char *str = *menu->keyboard.buffer;
|
||||
if (!str)
|
||||
str = "";
|
||||
glui_render_quad(gl, 0, 0, gl->win_width, gl->win_height, 0, 0, 0, 0.75);
|
||||
glui_render_quad(gl, 0, 0, global->video_data.width, global->video_data.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, gl->win_width, gl->win_height, 0, 0, 0, 0.75);
|
||||
glui_render_quad(gl, 0, 0, global->video_data.width, global->video_data.height, 0, 0, 0, 0.75);
|
||||
glui_render_messagebox(glui->box_message);
|
||||
glui->box_message[0] = '\0';
|
||||
}
|
||||
@ -571,7 +576,7 @@ static void glui_frame(void)
|
||||
|
||||
gl->shader->use(gl, GL_SHADER_STOCK_BLEND);
|
||||
|
||||
gl_set_viewport(gl, gl->win_width, gl->win_height, false, true);
|
||||
gl_set_viewport(gl, global->video_data.width, global->video_data.height, false, true);
|
||||
}
|
||||
|
||||
static void *glui_init(void)
|
||||
@ -689,6 +694,7 @@ static float glui_get_scroll(void)
|
||||
int half;
|
||||
glui_handle_t *glui = NULL;
|
||||
menu_handle_t *menu = menu_driver_get_ptr();
|
||||
global_t *global = global_get_ptr();
|
||||
gl_t *gl = (gl_t*)video_driver_get_ptr(NULL);
|
||||
|
||||
if (!menu)
|
||||
@ -699,7 +705,7 @@ static float glui_get_scroll(void)
|
||||
if (!glui)
|
||||
return 0;
|
||||
|
||||
half = (gl->win_height / glui->line_height) / 2;
|
||||
half = (global->video_data.height / glui->line_height) / 2;
|
||||
|
||||
if (menu->navigation.selection_ptr < half)
|
||||
return 0;
|
||||
|
@ -289,6 +289,7 @@ static void xmb_draw_icon(gl_t *gl, xmb_handle_t *xmb,
|
||||
{
|
||||
struct gl_coords coords;
|
||||
math_matrix_4x4 mymat, mrot, mscal;
|
||||
global_t *global = global_get_ptr();
|
||||
|
||||
if (alpha > xmb->alpha)
|
||||
alpha = xmb->alpha;
|
||||
@ -298,9 +299,9 @@ static void xmb_draw_icon(gl_t *gl, xmb_handle_t *xmb,
|
||||
|
||||
if (
|
||||
x < -xmb->icon.size/2 ||
|
||||
x > gl->win_width ||
|
||||
x > global->video_data.width ||
|
||||
y < xmb->icon.size/2 ||
|
||||
y > gl->win_height + xmb->icon.size)
|
||||
y > global->video_data.height + xmb->icon.size)
|
||||
return;
|
||||
|
||||
GLfloat color[] = {
|
||||
@ -313,7 +314,7 @@ static void xmb_draw_icon(gl_t *gl, xmb_handle_t *xmb,
|
||||
if (gl->shader && gl->shader->use)
|
||||
gl->shader->use(gl, GL_SHADER_STOCK_BLEND);
|
||||
|
||||
glViewport(x, gl->win_height - y, xmb->icon.size, xmb->icon.size);
|
||||
glViewport(x, global->video_data.height - y, xmb->icon.size, xmb->icon.size);
|
||||
|
||||
coords.vertices = 4;
|
||||
coords.vertex = rmb_vertex;
|
||||
@ -340,6 +341,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();
|
||||
|
||||
if (alpha > xmb->alpha)
|
||||
alpha = xmb->alpha;
|
||||
@ -349,9 +351,9 @@ static void xmb_draw_icon_predone(gl_t *gl, xmb_handle_t *xmb,
|
||||
|
||||
if (
|
||||
x < -xmb->icon.size/2 ||
|
||||
x > gl->win_width ||
|
||||
x > global->video_data.width ||
|
||||
y < xmb->icon.size/2 ||
|
||||
y > gl->win_height + xmb->icon.size)
|
||||
y > global->video_data.height + xmb->icon.size)
|
||||
return;
|
||||
|
||||
GLfloat color[] = {
|
||||
@ -364,7 +366,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, gl->win_height - y, xmb->icon.size, xmb->icon.size);
|
||||
glViewport(x, global->video_data.height - y, xmb->icon.size, xmb->icon.size);
|
||||
|
||||
coords.vertices = 4;
|
||||
coords.vertex = rmb_vertex;
|
||||
@ -385,8 +387,9 @@ static void xmb_draw_text(menu_handle_t *menu,
|
||||
float y, float scale_factor, float alpha,
|
||||
enum text_alignment text_align)
|
||||
{
|
||||
uint8_t a8 = 0;
|
||||
uint8_t a8 = 0;
|
||||
struct font_params params = {0};
|
||||
global_t *global = global_get_ptr();
|
||||
|
||||
if (alpha > xmb->alpha)
|
||||
alpha = xmb->alpha;
|
||||
@ -396,12 +399,12 @@ static void xmb_draw_text(menu_handle_t *menu,
|
||||
if (a8 == 0)
|
||||
return;
|
||||
|
||||
if (x < -xmb->icon.size || x > gl->win_width + xmb->icon.size
|
||||
|| y < -xmb->icon.size || y > gl->win_height + xmb->icon.size)
|
||||
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)
|
||||
return;
|
||||
|
||||
params.x = x / gl->win_width;
|
||||
params.y = 1.0f - y / gl->win_height;
|
||||
params.x = x / global->video_data.width;
|
||||
params.y = 1.0f - y / global->video_data.height;
|
||||
|
||||
params.scale = scale_factor;
|
||||
params.color = FONT_COLOR_RGBA(255, 255, 255, a8);
|
||||
@ -450,7 +453,8 @@ static void xmb_frame_background(settings_t *settings,
|
||||
};
|
||||
|
||||
/* force viewport to fullscreen */
|
||||
gl_set_viewport(gl, gl->win_width, gl->win_height, true, false);
|
||||
gl_set_viewport(gl, global->video_data.width,
|
||||
global->video_data.height, true, false);
|
||||
|
||||
coords.vertices = 4;
|
||||
coords.vertex = vertex;
|
||||
@ -505,6 +509,7 @@ static void xmb_frame_messagebox(const char *message)
|
||||
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;
|
||||
@ -526,8 +531,8 @@ static void xmb_frame_messagebox(const char *message)
|
||||
if (list->elems == 0)
|
||||
goto end;
|
||||
|
||||
x = gl->win_width / 2 - strlen(list->elems[0].data) * menu->font.size / 4;
|
||||
y = gl->win_height / 2 - list->size * menu->font.size / 2;
|
||||
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;
|
||||
|
||||
for (i = 0; i < list->size; i++)
|
||||
{
|
||||
@ -1058,6 +1063,7 @@ static void xmb_draw_items(xmb_handle_t *xmb, gl_t *gl,
|
||||
const char *label = NULL;
|
||||
xmb_node_t *core_node = NULL;
|
||||
size_t end = 0;
|
||||
global_t *global = global_get_ptr();
|
||||
|
||||
if (!list || !list->size)
|
||||
return;
|
||||
@ -1097,9 +1103,9 @@ static void xmb_draw_items(xmb_handle_t *xmb, gl_t *gl,
|
||||
|
||||
if (
|
||||
icon_x < -xmb->icon.size / 2 ||
|
||||
icon_x > gl->win_width ||
|
||||
icon_x > global->video_data.width ||
|
||||
icon_y < xmb->icon.size / 2 ||
|
||||
icon_y > gl->win_height + xmb->icon.size)
|
||||
icon_y > global->video_data.height + xmb->icon.size)
|
||||
continue;
|
||||
|
||||
menu_list_get_at_offset(list, i, &path, &entry_label, &type);
|
||||
@ -1213,6 +1219,7 @@ static void xmb_draw_cursor(gl_t *gl, xmb_handle_t *xmb, float x, float y)
|
||||
{
|
||||
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,
|
||||
@ -1221,7 +1228,7 @@ 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, gl->win_height - y, xmb->cursor.size, xmb->cursor.size);
|
||||
glViewport(x, global->video_data.height - y, xmb->cursor.size, xmb->cursor.size);
|
||||
|
||||
coords.vertices = 4;
|
||||
coords.vertex = rmb_vertex;
|
||||
@ -1339,7 +1346,7 @@ static void xmb_frame(void)
|
||||
|
||||
xmb_draw_text(menu, gl, xmb,
|
||||
timedate,
|
||||
gl->win_width - xmb->margins.title.left - xmb->icon.size / 4,
|
||||
global->video_data.width - xmb->margins.title.left - xmb->icon.size / 4,
|
||||
xmb->margins.title.top, 1, 1, TEXT_ALIGN_RIGHT);
|
||||
}
|
||||
|
||||
@ -1362,7 +1369,7 @@ static void xmb_frame(void)
|
||||
snprintf(title_msg, sizeof(title_msg), "%s - %s %s", PACKAGE_VERSION,
|
||||
core_name, core_version);
|
||||
xmb_draw_text(menu, gl, xmb, title_msg, xmb->margins.title.left,
|
||||
gl->win_height - xmb->margins.title.bottom, 1, 1, TEXT_ALIGN_LEFT);
|
||||
global->video_data.height - xmb->margins.title.bottom, 1, 1, TEXT_ALIGN_LEFT);
|
||||
}
|
||||
|
||||
depth = file_list_get_size(menu->menu_list->menu_stack);
|
||||
@ -1390,7 +1397,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,
|
||||
gl->win_width - xmb->icon.size, xmb->icon.size, 1, 0, 1);
|
||||
global->video_data.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 +
|
||||
@ -1453,7 +1460,7 @@ static void xmb_frame(void)
|
||||
if (settings->menu.mouse.enable)
|
||||
xmb_draw_cursor(gl, xmb, menu->mouse.x, menu->mouse.y);
|
||||
|
||||
gl_set_viewport(gl, gl->win_width, gl->win_height, false, true);
|
||||
gl_set_viewport(gl, global->video_data.width, global->video_data.height, false, true);
|
||||
}
|
||||
|
||||
static void *xmb_init(void)
|
||||
@ -1519,20 +1526,20 @@ static void *xmb_init(void)
|
||||
xmb->item.active.factor = 3.0;
|
||||
xmb->under_offset.item = 5.0;
|
||||
|
||||
menu->frame_buf.width = gl->win_width;
|
||||
menu->frame_buf.height = gl->win_height;
|
||||
menu->frame_buf.width = global->video_data.width;
|
||||
menu->frame_buf.height = global->video_data.height;
|
||||
|
||||
if (gl->win_width >= 3840)
|
||||
if (global->video_data.width >= 3840)
|
||||
scale_factor = 2.0;
|
||||
else if (gl->win_width >= 2560)
|
||||
else if (global->video_data.width >= 2560)
|
||||
scale_factor = 1.5;
|
||||
else if (gl->win_width >= 1920)
|
||||
else if (global->video_data.width >= 1920)
|
||||
scale_factor = 1.0;
|
||||
else if (gl->win_width >= 1280)
|
||||
else if (global->video_data.width >= 1280)
|
||||
scale_factor = 0.75;
|
||||
else if (gl->win_width >= 640)
|
||||
else if (global->video_data.width >= 640)
|
||||
scale_factor = 0.5;
|
||||
else if (gl->win_width >= 320)
|
||||
else if (global->video_data.width >= 320)
|
||||
scale_factor = 0.25;
|
||||
|
||||
strlcpy(xmb->icon.dir, "256", sizeof(xmb->icon.dir));
|
||||
|
Loading…
Reference in New Issue
Block a user