From c200ffffe85549f29a2019f1111f5f459c5b92c9 Mon Sep 17 00:00:00 2001 From: UnknownShadow200 Date: Mon, 21 Sep 2020 00:17:27 +1000 Subject: [PATCH] and fix padding for top and bottom of inventory table --- src/Widgets.c | 11 +++++++---- src/Widgets.h | 1 + 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/Widgets.c b/src/Widgets.c index 5fe9c2ca2..b7003425f 100644 --- a/src/Widgets.c +++ b/src/Widgets.c @@ -564,13 +564,13 @@ void HotbarWidget_Create(struct HotbarWidget* w) { /*########################################################################################################################* *-------------------------------------------------------TableWidget-------------------------------------------------------* *#########################################################################################################################*/ -static int Table_X(struct TableWidget* w) { return w->x - w->paddingX; } -static int Table_Y(struct TableWidget* w) { return w->y - 5 - 30; } +static int Table_X(struct TableWidget* w) { return w->x - w->paddingX; } +static int Table_Y(struct TableWidget* w) { return w->y - w->paddingTopY; } static int Table_Width(struct TableWidget* w) { return w->blocksPerRow * w->cellSizeX + w->paddingX * 2; } static int Table_Height(struct TableWidget* w) { - return w->rowsVisible * w->cellSizeY + 10 + 40; + return w->rowsVisible * w->cellSizeY + w->paddingTopY + w->paddingMaxY; } #define TABLE_MAX_VERTICES (8 * 10 * ISOMETRICDRAWER_MAXVERTICES) @@ -890,7 +890,10 @@ void TableWidget_Create(struct TableWidget* w) { w->horAnchor = ANCHOR_CENTRE; w->verAnchor = ANCHOR_CENTRE; w->lastX = -20; w->lastY = -20; - w->paddingX = Display_ScaleX(15); + + w->paddingX = Display_ScaleX(15); + w->paddingTopY = Display_ScaleY(15 + 20); + w->paddingMaxY = Display_ScaleX(15); } void TableWidget_SetBlockTo(struct TableWidget* w, BlockID block) { diff --git a/src/Widgets.h b/src/Widgets.h index 558a4a9c6..e455161c6 100644 --- a/src/Widgets.h +++ b/src/Widgets.h @@ -93,6 +93,7 @@ struct TableWidget { struct ScrollbarWidget scroll; struct Texture descTex; int lastX, lastY, paddingX; + int paddingTopY, paddingMaxY; }; CC_NOINLINE void TableWidget_Create(struct TableWidget* w);