(XMB) Draw gradient

This commit is contained in:
Jean-André Santoni 2016-04-17 03:06:20 +07:00
parent 1b0381ca02
commit 8317c5849c
3 changed files with 50 additions and 7 deletions

View File

@ -1909,18 +1909,20 @@ static void xmb_draw_ribbon(menu_display_ctx_draw_t *draw)
video_shader_ctx_info_t shader_info; video_shader_ctx_info_t shader_info;
math_matrix_4x4 mymat; math_matrix_4x4 mymat;
struct gfx_coords coords; struct gfx_coords coords;
float bg[16] = { float white[16] = {
1, 0, 0.1, 1, 1, 1, 1, 1,
1, 0.1, 0, 1, 1, 1, 1, 1,
0.05, 0, 0.05, 1, 1, 1, 1, 1,
0.05, 0, 0.05, 1 1, 1, 1, 1,
}; };
coords.vertices = draw->vertex_count; menu_display_ctl(MENU_DISPLAY_CTL_DRAW_GRADIENT, draw);
coords.color = bg;
xmb_blend_begin(); xmb_blend_begin();
coords.vertices = draw->vertex_count;
coords.color = white;
draw->x = 0; draw->x = 0;
draw->y = 0; draw->y = 0;
draw->coords = &coords; draw->coords = &coords;

View File

@ -497,6 +497,46 @@ bool menu_display_ctl(enum menu_display_ctl_state state, void *data)
menu_disp->draw(draw); menu_disp->draw(draw);
} }
break; break;
case MENU_DISPLAY_CTL_DRAW_GRADIENT:
{
struct gfx_coords coords;
const float *new_vertex = NULL;
const float *new_tex_coord = NULL;
menu_display_ctx_draw_t *draw = (menu_display_ctx_draw_t*)data;
float bg[16] = {
1, 0, 0.1, 1,
1, 0.1, 0, 1,
0.05, 0, 0.05, 1,
0.05, 0, 0.05, 1
};
if (!menu_disp || !draw)
return false;
new_vertex = draw->vertex;
new_tex_coord = draw->tex_coord;
if (!new_vertex)
new_vertex = menu_disp->get_default_vertices();
if (!new_tex_coord)
new_tex_coord = menu_disp->get_default_tex_coords();
coords.vertices = draw->vertex_count;
coords.vertex = new_vertex;
coords.tex_coord = new_tex_coord;
coords.lut_tex_coord = new_tex_coord;
coords.color = bg;
draw->x = 0;
draw->y = 0;
draw->coords = &coords;
draw->texture = menu_display_white_texture;
draw->matrix_data = (math_matrix_4x4*)menu_disp->get_default_mvp();
menu_disp->draw(draw);
}
break;
case MENU_DISPLAY_CTL_ROTATE_Z: case MENU_DISPLAY_CTL_ROTATE_Z:
{ {
math_matrix_4x4 matrix_rotated, matrix_scaled; math_matrix_4x4 matrix_rotated, matrix_scaled;

View File

@ -75,6 +75,7 @@ enum menu_display_ctl_state
MENU_DISPLAY_CTL_CLEAR_COLOR, MENU_DISPLAY_CTL_CLEAR_COLOR,
MENU_DISPLAY_CTL_DRAW, MENU_DISPLAY_CTL_DRAW,
MENU_DISPLAY_CTL_DRAW_BG, MENU_DISPLAY_CTL_DRAW_BG,
MENU_DISPLAY_CTL_DRAW_GRADIENT,
MENU_DISPLAY_CTL_ROTATE_Z, MENU_DISPLAY_CTL_ROTATE_Z,
MENU_DISPLAY_CTL_TEX_COORDS_GET, MENU_DISPLAY_CTL_TEX_COORDS_GET,
MENU_DISPLAY_CTL_TIMEDATE MENU_DISPLAY_CTL_TIMEDATE