From cd367d8e97081f9daa9e9ede04f4412a449c77f4 Mon Sep 17 00:00:00 2001 From: UnknownShadow200 Date: Fri, 6 Aug 2021 20:06:10 +1000 Subject: [PATCH] Improve classic theme, add border for checkbox --- src/LBackend.c | 48 +++++++++++++++++++++++++----------------------- src/Launcher.c | 6 +++--- 2 files changed, 28 insertions(+), 26 deletions(-) diff --git a/src/LBackend.c b/src/LBackend.c index 673abd530..ed81aca5f 100644 --- a/src/LBackend.c +++ b/src/LBackend.c @@ -89,6 +89,21 @@ void LBackend_CalcOffsets(void) { yInputOffset = Display_ScaleY(2); } +static void DrawBoxBounds(BitmapCol col, int x, int y, int width, int height) { + Drawer2D_Clear(&Launcher_Framebuffer, col, + x, y, + width, yBorder); + Drawer2D_Clear(&Launcher_Framebuffer, col, + x, y + height - yBorder, + width, yBorder); + Drawer2D_Clear(&Launcher_Framebuffer, col, + x, y, + xBorder, height); + Drawer2D_Clear(&Launcher_Framebuffer, col, + x + width - xBorder, y, + xBorder, height); +} + /*########################################################################################################################* *------------------------------------------------------ButtonWidget-------------------------------------------------------* @@ -118,9 +133,7 @@ static void LButton_DrawBackground(struct LButton* w) { } static void LButton_DrawBorder(struct LButton* w) { - BitmapCol black = BitmapCol_Make(0, 0, 0, 255); - BitmapCol backCol = Launcher_Theme.ClassicBackground ? black : Launcher_Theme.ButtonBorderColor; - + BitmapCol backCol = Launcher_Theme.ButtonBorderColor; Drawer2D_Clear(&Launcher_Framebuffer, backCol, w->x + xBorder, w->y, w->width - xBorder2, yBorder); @@ -136,20 +149,20 @@ static void LButton_DrawBorder(struct LButton* w) { } static void LButton_DrawHighlight(struct LButton* w) { - BitmapCol activeCol = BitmapCol_Make(189, 198, 255, 255); - BitmapCol inactiveCol = BitmapCol_Make(168, 168, 168, 255); - BitmapCol highlightCol; + BitmapCol activeCol = BitmapCol_Make(189, 198, 255, 255); + BitmapCol col = Launcher_Theme.ButtonHighlightColor; if (Launcher_Theme.ClassicBackground) { - highlightCol = w->hovered ? activeCol : inactiveCol; - Drawer2D_Clear(&Launcher_Framebuffer, highlightCol, + if (w->hovered) col = activeCol; + + Drawer2D_Clear(&Launcher_Framebuffer, col, w->x + xBorder2, w->y + yBorder, w->width - xBorder4, yBorder); - Drawer2D_Clear(&Launcher_Framebuffer, highlightCol, + Drawer2D_Clear(&Launcher_Framebuffer, col, w->x + xBorder, w->y + yBorder2, xBorder, w->height - yBorder4); } else if (!w->hovered) { - Drawer2D_Clear(&Launcher_Framebuffer, Launcher_Theme.ButtonHighlightColor, + Drawer2D_Clear(&Launcher_Framebuffer, col, w->x + xBorder2, w->y + yBorder, w->width - xBorder4, yBorder); } @@ -246,7 +259,7 @@ void LBackend_DrawCheckbox(struct LCheckbox* w) { int y = w->y + w->height / 2 - size / 2; DrawIndexed(size, x, y, &Launcher_Framebuffer); } - /*drawer.DrawRectBounds(black, 1, w->X, Y, Width - 1, Height - 1);*/ + DrawBoxBounds(black, w->x, w->y, w->width, w->height); } @@ -257,18 +270,7 @@ static void LInput_DrawOuterBorder(struct LInput* w) { BitmapCol col = BitmapCol_Make(97, 81, 110, 255); if (w->selected) { - Drawer2D_Clear(&Launcher_Framebuffer, col, - w->x, w->y, - w->width, yBorder); - Drawer2D_Clear(&Launcher_Framebuffer, col, - w->x, w->y + w->height - yBorder, - w->width, yBorder); - Drawer2D_Clear(&Launcher_Framebuffer, col, - w->x, w->y, - xBorder, w->height); - Drawer2D_Clear(&Launcher_Framebuffer, col, - w->x + w->width - xBorder, w->y, - xBorder, w->height); + DrawBoxBounds(col, w->x, w->y, w->width, w->height); } else { Launcher_ResetArea(w->x, w->y, w->width, yBorder); diff --git a/src/Launcher.c b/src/Launcher.c index df8b0c8b7..2d4f6f37d 100644 --- a/src/Launcher.c +++ b/src/Launcher.c @@ -366,11 +366,11 @@ const struct LauncherTheme Launcher_ModernTheme = { const struct LauncherTheme Launcher_ClassicTheme = { true, - BitmapCol_Make(153, 127, 172, 255), /* background WIP */ - BitmapCol_Make( 97, 81, 110, 255), /* button border WIP */ + BitmapCol_Make( 50, 50, 50, 255), /* background */ + BitmapCol_Make( 0, 0, 0, 255), /* button border */ BitmapCol_Make(126, 136, 191, 255), /* active button */ BitmapCol_Make(111, 111, 111, 255), /* button foreground */ - BitmapCol_Make(162, 131, 186, 255), /* button highlight WIP */ + BitmapCol_Make(168, 168, 168, 255), /* button highlight */ }; CC_NOINLINE static void Launcher_GetCol(const char* key, BitmapCol* col) {