From 4ef5c0dd158ae337f931b34183679a35f60f6a05 Mon Sep 17 00:00:00 2001 From: Adubbz Date: Thu, 22 Feb 2018 23:23:51 +1100 Subject: [PATCH] Added a subtle shadow to the icons --- common/menu.c | 66 ++++++++++++++++++++++++++++++++++++++------------ common/theme.c | 2 +- 2 files changed, 51 insertions(+), 17 deletions(-) diff --git a/common/menu.c b/common/menu.c index 7e78f44..eadd9d3 100644 --- a/common/menu.c +++ b/common/menu.c @@ -36,25 +36,37 @@ static void drawEntry(menuEntry_s* me, int off_x, int is_active) { int end_y = start_y + 140 + 32; int start_x = off_x;//(n / 2); int end_x = start_x + 140; + const uint8_t *smallimg = NULL; const uint8_t *largeimg = NULL; char tmpstr[1024]; + int border_start_x, border_end_x; + int border_start_y, border_end_y; color_t border_color = MakeColor(255, 255, 255, 255); + + int shadow_start_y, shadow_y; + int shadow_inset; + color_t shadow_color; + uint8_t shadow_alpha_base = 80; + int shadow_size = 4; if (is_active) { border_color = themeCurrent.highlightColor; + border_start_x = start_x-5; + border_end_x = end_x+5; + border_start_y = start_y-5; + border_end_y = end_y+5; + } + else { + border_start_x = start_x-3; + border_end_x = end_x+3; + border_start_y = start_y-3; + border_end_y = end_y+3; } //{ - for (x=(start_x-5); x<(end_x+5); x++) { - if (!is_active) { - if (x < start_x-3) - continue; - else if (x >= end_x+3) - break; - } - + for (x=border_start_x; x= border_start_x + shadow_inset && x <= border_end_x - shadow_inset) { + DrawPixel(x, end_y +shadow_y, shadow_color); + } } } - for (y=(start_y-5); y<(end_y+5); y++) { - if (!is_active) { - if (y < start_y-3) - continue; - else if (y >= end_y+3) - break; - } - + for (y=border_start_y; y= border_start_x + shadow_inset && x <= border_end_x - shadow_inset) { + DrawPixel(x, shadow_y, shadow_color); + } + } + } } DrawTextTruncate(tahoma12, start_x + 8, start_y + 8, MakeColor(64, 64, 64, 255), me->name, 140 - 32, "..."); diff --git a/common/theme.c b/common/theme.c index 6c25ae7..80484b7 100644 --- a/common/theme.c +++ b/common/theme.c @@ -9,7 +9,7 @@ void themeStartup(ThemePreset preset) { middleWaveColor: MakeColor(66, 154, 159, 255), backWaveColor: MakeColor(73, 103, 169, 255), backgroundColor: MakeColor(45, 55, 66, 255), - highlightColor: MakeColor(73, 103, 169, 255), + highlightColor: MakeColor(129, 137, 236, 255), enableWaveBlending: 0 }; break;