From abd3e2853be40263302a98f28f32c8df1aaa1be9 Mon Sep 17 00:00:00 2001 From: UnknownShadow200 Date: Tue, 30 Jul 2019 22:53:14 +1000 Subject: [PATCH] Scale up resources menu background box with DPI --- src/Drawer2D.h | 7 +------ src/LScreens.c | 15 +++++++++------ src/Widgets.c | 2 +- 3 files changed, 11 insertions(+), 13 deletions(-) diff --git a/src/Drawer2D.h b/src/Drawer2D.h index 70f5321cb..555a14c86 100644 --- a/src/Drawer2D.h +++ b/src/Drawer2D.h @@ -84,14 +84,9 @@ CC_API void Drawer2D_MakeTextTexture(struct Texture* tex, struct DrawTextArgs* a /* used specifies what region of the texture actually should be drawn. */ CC_API void Drawer2D_Make2DTexture(struct Texture* tex, Bitmap* bmp, Size2D used, int X, int Y); -/* Returns whether the given colour code is used/valid. */ -bool Drawer2D_ValidColCodeAt(const String* text, int i); /* Returns whether the given colour code is used/valid. */ /* NOTE: This can change if the server defines custom colour codes. */ -static CC_INLINE bool Drawer2D_ValidColCode(char c) { - return Drawer2D_GetCol(c).A > 0; -} - +bool Drawer2D_ValidColCodeAt(const String* text, int i); /* Whether text is empty or consists purely of valid colour codes. */ bool Drawer2D_IsEmptyText(const String* text); /* Returns the last valid colour code in the given input, or \0 if not found. */ diff --git a/src/LScreens.c b/src/LScreens.c index 4db7bd4a1..ced6287cb 100644 --- a/src/LScreens.c +++ b/src/LScreens.c @@ -998,16 +998,19 @@ CC_NOINLINE static void ResourcesScreen_ResetArea(int x, int y, int width, int h Launcher_MarkDirty(x, y, width, height); } -#define RESOURCES_XSIZE 190 -#define RESOURCES_YSIZE 70 static void ResourcesScreen_Draw(struct LScreen* s) { - BitmapCol backCol = BITMAPCOL_CONST( 12, 12, 12, 255); + BitmapCol backCol = BITMAPCOL_CONST(12, 12, 12, 255); + int x, y, width, height; Drawer2D_Clear(&Launcher_Framebuffer, backCol, 0, 0, Window_Width, Window_Height); - ResourcesScreen_ResetArea( - Window_Width / 2 - RESOURCES_XSIZE, Window_Height / 2 - RESOURCES_YSIZE, - RESOURCES_XSIZE * 2, RESOURCES_YSIZE * 2); + width = Display_ScaleX(380); + height = Display_ScaleY(140); + + x = Gui_CalcPos(ANCHOR_CENTRE, 0, width, Window_Width); + y = Gui_CalcPos(ANCHOR_CENTRE, 0, height, Window_Height); + + ResourcesScreen_ResetArea(x, y, width, height); LScreen_Draw(s); } diff --git a/src/Widgets.c b/src/Widgets.c index 6d3f8cc55..35df14898 100644 --- a/src/Widgets.c +++ b/src/Widgets.c @@ -1052,7 +1052,7 @@ static bool InputWidget_CheckCol(struct InputWidget* w, int index) { code = w->text.buffer[index]; col = w->text.buffer[index + 1]; - return (code == '%' || code == '&') && Drawer2D_ValidColCode(col); + return (code == '%' || code == '&') && Drawer2D_GetCol(col).A; } static void InputWidget_BackspaceKey(struct InputWidget* w) {