and fix padding for top and bottom of inventory table

This commit is contained in:
UnknownShadow200 2020-09-21 00:17:27 +10:00
parent 75d437fdb1
commit c200ffffe8
2 changed files with 8 additions and 4 deletions

View File

@ -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) {

View File

@ -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);