mirror of
https://github.com/libretro/RetroArch
synced 2025-04-09 21:45:45 +00:00
(Menu) Create gl_menu_frame_background
This commit is contained in:
parent
42fc1fb9a8
commit
b97e880c01
@ -106,64 +106,6 @@ static void glui_blit_line(float x, float y,
|
|||||||
video_driver_set_osd_msg(message, ¶ms, menu->font.buf);
|
video_driver_set_osd_msg(message, ¶ms, menu->font.buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void glui_render_background(settings_t *settings, gl_t *gl,
|
|
||||||
glui_handle_t *glui)
|
|
||||||
{
|
|
||||||
static const GLfloat vertex[] = {
|
|
||||||
0, 0,
|
|
||||||
1, 0,
|
|
||||||
0, 1,
|
|
||||||
1, 1,
|
|
||||||
};
|
|
||||||
|
|
||||||
static const GLfloat tex_coord[] = {
|
|
||||||
0, 1,
|
|
||||||
1, 1,
|
|
||||||
0, 0,
|
|
||||||
1, 0,
|
|
||||||
};
|
|
||||||
struct gl_coords coords;
|
|
||||||
float alpha = 0.75f;
|
|
||||||
GLfloat color[] = {
|
|
||||||
1.0f, 1.0f, 1.0f, alpha,
|
|
||||||
1.0f, 1.0f, 1.0f, alpha,
|
|
||||||
1.0f, 1.0f, 1.0f, alpha,
|
|
||||||
1.0f, 1.0f, 1.0f, alpha,
|
|
||||||
};
|
|
||||||
|
|
||||||
GLfloat black_color[] = {
|
|
||||||
0.0f, 0.0f, 0.0f, alpha,
|
|
||||||
0.0f, 0.0f, 0.0f, alpha,
|
|
||||||
0.0f, 0.0f, 0.0f, alpha,
|
|
||||||
0.0f, 0.0f, 0.0f, alpha,
|
|
||||||
};
|
|
||||||
global_t *global = global_get_ptr();
|
|
||||||
|
|
||||||
glViewport(0, 0, global->video_data.width, global->video_data.height);
|
|
||||||
|
|
||||||
coords.vertices = 4;
|
|
||||||
coords.vertex = vertex;
|
|
||||||
coords.tex_coord = tex_coord;
|
|
||||||
coords.lut_tex_coord = tex_coord;
|
|
||||||
|
|
||||||
if ((settings->menu.pause_libretro
|
|
||||||
|| !global->main_is_init || global->libretro_dummy)
|
|
||||||
&& glui->textures.bg.id)
|
|
||||||
{
|
|
||||||
coords.color = color;
|
|
||||||
glBindTexture(GL_TEXTURE_2D, glui->textures.bg.id);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
coords.color = black_color;
|
|
||||||
glBindTexture(GL_TEXTURE_2D, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
menu_gl_draw_frame(gl->shader, &coords, &gl->mvp_no_rot, true);
|
|
||||||
|
|
||||||
gl->coords.color = gl->white_color_ptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void glui_render_quad(gl_t *gl, int x, int y, int w, int h,
|
static void glui_render_quad(gl_t *gl, int x, int y, int w, int h,
|
||||||
float r, float g, float b, float a)
|
float r, float g, float b, float a)
|
||||||
{
|
{
|
||||||
@ -458,7 +400,7 @@ static void glui_frame(void)
|
|||||||
|
|
||||||
menu_display_set_viewport(menu);
|
menu_display_set_viewport(menu);
|
||||||
|
|
||||||
glui_render_background(settings, gl, glui);
|
gl_menu_frame_background(menu, settings, gl, glui->textures.bg.id, 0.75f, 0.75f, false);
|
||||||
|
|
||||||
menu_list_get_last_stack(menu->menu_list, &dir, &label, &menu_type);
|
menu_list_get_last_stack(menu->menu_list, &dir, &label, &menu_type);
|
||||||
|
|
||||||
|
@ -42,6 +42,76 @@ static INLINE void menu_gl_draw_frame(
|
|||||||
if (blend)
|
if (blend)
|
||||||
glDisable(GL_BLEND);
|
glDisable(GL_BLEND);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static INLINE void gl_menu_frame_background(
|
||||||
|
menu_handle_t *menu,
|
||||||
|
settings_t *settings,
|
||||||
|
gl_t *gl,
|
||||||
|
GLuint texture,
|
||||||
|
float handle_alpha,
|
||||||
|
float alpha,
|
||||||
|
bool force_transparency)
|
||||||
|
{
|
||||||
|
struct gl_coords coords;
|
||||||
|
static const GLfloat vertex[] = {
|
||||||
|
0, 0,
|
||||||
|
1, 0,
|
||||||
|
0, 1,
|
||||||
|
1, 1,
|
||||||
|
};
|
||||||
|
global_t *global = global_get_ptr();
|
||||||
|
|
||||||
|
static const GLfloat tex_coord[] = {
|
||||||
|
0, 1,
|
||||||
|
1, 1,
|
||||||
|
0, 0,
|
||||||
|
1, 0,
|
||||||
|
};
|
||||||
|
|
||||||
|
GLfloat color[] = {
|
||||||
|
1.0f, 1.0f, 1.0f, handle_alpha,
|
||||||
|
1.0f, 1.0f, 1.0f, handle_alpha,
|
||||||
|
1.0f, 1.0f, 1.0f, handle_alpha,
|
||||||
|
1.0f, 1.0f, 1.0f, handle_alpha,
|
||||||
|
};
|
||||||
|
|
||||||
|
if (alpha > handle_alpha)
|
||||||
|
alpha = handle_alpha;
|
||||||
|
|
||||||
|
GLfloat black_color[] = {
|
||||||
|
0.0f, 0.0f, 0.0f, alpha,
|
||||||
|
0.0f, 0.0f, 0.0f, alpha,
|
||||||
|
0.0f, 0.0f, 0.0f, alpha,
|
||||||
|
0.0f, 0.0f, 0.0f, alpha,
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
coords.vertices = 4;
|
||||||
|
coords.vertex = vertex;
|
||||||
|
coords.tex_coord = tex_coord;
|
||||||
|
coords.lut_tex_coord = tex_coord;
|
||||||
|
|
||||||
|
menu_display_set_viewport(menu);
|
||||||
|
|
||||||
|
if ((settings->menu.pause_libretro
|
||||||
|
|| !global->main_is_init || global->libretro_dummy)
|
||||||
|
&& !force_transparency
|
||||||
|
&& texture)
|
||||||
|
{
|
||||||
|
coords.color = color;
|
||||||
|
glBindTexture(GL_TEXTURE_2D, texture);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
coords.color = black_color;
|
||||||
|
glBindTexture(GL_TEXTURE_2D, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
menu_gl_draw_frame(gl->shader, &coords,
|
||||||
|
&gl->mvp_no_rot, true);
|
||||||
|
|
||||||
|
gl->coords.color = gl->white_color_ptr;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static INLINE void get_title(const char *label, const char *dir,
|
static INLINE void get_title(const char *label, const char *dir,
|
||||||
|
@ -401,73 +401,6 @@ static void xmb_draw_text(menu_handle_t *menu,
|
|||||||
video_driver_set_osd_msg(str, ¶ms, menu->font.buf);
|
video_driver_set_osd_msg(str, ¶ms, menu->font.buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void xmb_frame_background(menu_handle_t *menu,
|
|
||||||
settings_t *settings,
|
|
||||||
gl_t *gl, xmb_handle_t *xmb,
|
|
||||||
bool force_transparency)
|
|
||||||
{
|
|
||||||
struct gl_coords coords;
|
|
||||||
float alpha = 0.75f;
|
|
||||||
static const GLfloat vertex[] = {
|
|
||||||
0, 0,
|
|
||||||
1, 0,
|
|
||||||
0, 1,
|
|
||||||
1, 1,
|
|
||||||
};
|
|
||||||
global_t *global = global_get_ptr();
|
|
||||||
|
|
||||||
static const GLfloat tex_coord[] = {
|
|
||||||
0, 1,
|
|
||||||
1, 1,
|
|
||||||
0, 0,
|
|
||||||
1, 0,
|
|
||||||
};
|
|
||||||
|
|
||||||
GLfloat color[] = {
|
|
||||||
1.0f, 1.0f, 1.0f, xmb->alpha,
|
|
||||||
1.0f, 1.0f, 1.0f, xmb->alpha,
|
|
||||||
1.0f, 1.0f, 1.0f, xmb->alpha,
|
|
||||||
1.0f, 1.0f, 1.0f, xmb->alpha,
|
|
||||||
};
|
|
||||||
|
|
||||||
if (alpha > xmb->alpha)
|
|
||||||
alpha = xmb->alpha;
|
|
||||||
|
|
||||||
GLfloat black_color[] = {
|
|
||||||
0.0f, 0.0f, 0.0f, alpha,
|
|
||||||
0.0f, 0.0f, 0.0f, alpha,
|
|
||||||
0.0f, 0.0f, 0.0f, alpha,
|
|
||||||
0.0f, 0.0f, 0.0f, alpha,
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
coords.vertices = 4;
|
|
||||||
coords.vertex = vertex;
|
|
||||||
coords.tex_coord = tex_coord;
|
|
||||||
coords.lut_tex_coord = tex_coord;
|
|
||||||
|
|
||||||
menu_display_set_viewport(menu);
|
|
||||||
|
|
||||||
if ((settings->menu.pause_libretro
|
|
||||||
|| !global->main_is_init || global->libretro_dummy)
|
|
||||||
&& !force_transparency
|
|
||||||
&& xmb->textures.bg.id)
|
|
||||||
{
|
|
||||||
coords.color = color;
|
|
||||||
glBindTexture(GL_TEXTURE_2D, xmb->textures.bg.id);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
coords.color = black_color;
|
|
||||||
glBindTexture(GL_TEXTURE_2D, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
menu_gl_draw_frame(gl->shader, &coords,
|
|
||||||
&gl->mvp_no_rot, true);
|
|
||||||
|
|
||||||
gl->coords.color = gl->white_color_ptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void xmb_render_messagebox_internal(const char *message)
|
static void xmb_render_messagebox_internal(const char *message)
|
||||||
{
|
{
|
||||||
xmb_handle_t *xmb = NULL;
|
xmb_handle_t *xmb = NULL;
|
||||||
@ -1304,7 +1237,7 @@ static void xmb_frame(void)
|
|||||||
|
|
||||||
xmb->raster_block.carr.coords.vertices = 0;
|
xmb->raster_block.carr.coords.vertices = 0;
|
||||||
|
|
||||||
xmb_frame_background(menu, settings, gl, xmb, false);
|
gl_menu_frame_background(menu, settings, gl, xmb->textures.bg.id, xmb->alpha, 0.75f, false);
|
||||||
|
|
||||||
xmb_draw_text(menu, xmb,
|
xmb_draw_text(menu, xmb,
|
||||||
xmb->title_name, xmb->margins.title.left,
|
xmb->title_name, xmb->margins.title.left,
|
||||||
@ -1422,7 +1355,7 @@ static void xmb_frame(void)
|
|||||||
|
|
||||||
if (render_background)
|
if (render_background)
|
||||||
{
|
{
|
||||||
xmb_frame_background(menu, settings, gl, xmb, true);
|
gl_menu_frame_background(menu, settings, gl, xmb->textures.bg.id, xmb->alpha, 0.75f, true);
|
||||||
xmb_frame_messagebox(msg);
|
xmb_frame_messagebox(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user