(XMB) Subtler drop shadows

This commit is contained in:
Jean-André Santoni 2016-04-09 13:23:59 +07:00
parent 8c02d63f2e
commit 64e2f9e2f0
4 changed files with 12 additions and 5 deletions

View File

@ -427,7 +427,7 @@ static void gl_raster_font_restore_viewport(gl_t *gl)
static void gl_raster_font_render_msg(void *data, const char *msg,
const void *userdata)
{
GLfloat x, y, scale, drop_mod;
GLfloat x, y, scale, drop_mod, drop_alpha;
GLfloat color[4], color_dark[4];
int drop_x, drop_y;
bool full_screen;
@ -455,6 +455,7 @@ static void gl_raster_font_render_msg(void *data, const char *msg,
drop_x = params->drop_x;
drop_y = params->drop_y;
drop_mod = params->drop_mod;
drop_alpha = params->drop_alpha;
color[0] = FONT_COLOR_GET_RED(params->color) / 255.0f;
color[1] = FONT_COLOR_GET_GREEN(params->color) / 255.0f;
@ -481,6 +482,7 @@ static void gl_raster_font_render_msg(void *data, const char *msg,
drop_x = -2;
drop_y = -2;
drop_mod = 0.3f;
drop_alpha = 1.0f;
}
if (font && font->block)
@ -493,7 +495,7 @@ static void gl_raster_font_render_msg(void *data, const char *msg,
color_dark[0] = color[0] * drop_mod;
color_dark[1] = color[1] * drop_mod;
color_dark[2] = color[2] * drop_mod;
color_dark[3] = color[3];
color_dark[3] = color[3] * drop_alpha;
gl_raster_font_render_message(font, msg, scale, color_dark,
x + scale * drop_x / gl->vp.width, y +

View File

@ -253,7 +253,7 @@ static void vulkan_raster_font_flush(vulkan_raster_t *font)
static void vulkan_raster_font_render_msg(void *data, const char *msg,
const void *userdata)
{
float x, y, scale, drop_mod;
float x, y, scale, drop_mod, drop_alpha;
float color[4], color_dark[4];
int drop_x, drop_y;
bool full_screen;
@ -279,6 +279,7 @@ static void vulkan_raster_font_render_msg(void *data, const char *msg,
drop_x = params->drop_x;
drop_y = params->drop_y;
drop_mod = params->drop_mod;
drop_alpha = params->drop_alpha;
color[0] = FONT_COLOR_GET_RED(params->color) / 255.0f;
color[1] = FONT_COLOR_GET_GREEN(params->color) / 255.0f;
@ -305,6 +306,7 @@ static void vulkan_raster_font_render_msg(void *data, const char *msg,
drop_x = -2;
drop_y = -2;
drop_mod = 0.3f;
drop_alpha = 1.0f;
}
vulkan_raster_font_setup_viewport(font, full_screen);
@ -325,7 +327,7 @@ static void vulkan_raster_font_render_msg(void *data, const char *msg,
color_dark[0] = color[0] * drop_mod;
color_dark[1] = color[1] * drop_mod;
color_dark[2] = color[2] * drop_mod;
color_dark[3] = color[3];
color_dark[3] = color[3] * drop_alpha;
vulkan_raster_font_render_message(font, msg, scale, color_dark,
x + scale * drop_x / vk->vp.width, y +

View File

@ -85,6 +85,8 @@ struct font_params
/* Drop shadow offset.
* If both are 0, no drop shadow will be rendered. */
int drop_x, drop_y;
/* Drop shadow alpha */
float drop_alpha;
/* ABGR. Use the macros. */
uint32_t color;
bool full_screen;

View File

@ -400,7 +400,7 @@ static void xmb_draw_icon_predone(xmb_handle_t *xmb,
{
for (i = 0; i < 16; i++)
shadow[i] = 0;
shadow[3] = shadow[7] = shadow[11] = shadow[15] = color[3];
shadow[3] = shadow[7] = shadow[11] = shadow[15] = color[3]/4;
coords.color = shadow;
draw.x = x + 2;
@ -523,6 +523,7 @@ static void xmb_draw_text(xmb_handle_t *xmb,
{
params.drop_x = 2.0f;
params.drop_y = -2.0f;
params.drop_alpha = 0.25f;
}
menu_display_ctl(MENU_DISPLAY_CTL_FONT_BUF, &disp_buf);