Merge pull request #3104 from Sundar-Gandu/master

mixin: add setter and change getter name for widget variable
This commit is contained in:
Justin
2022-01-03 04:09:57 +11:00
committed by GitHub
3 changed files with 25 additions and 6 deletions

View File

@@ -1085,4 +1085,14 @@ public interface Widget
* Gets the image which is (or should be) drawn on this widget
*/
SpritePixels getSprite();
/**
* Sets the X padding between widgets, mainly for inventory items
*/
void setPaddingX(int val);
/**
* Sets the Y padding between widgets, mainly for inventory items
*/
void setPaddingY(int val);
}

View File

@@ -323,8 +323,8 @@ public abstract class RSWidgetMixin implements RSWidget
}
int columns = getWidth(); // the number of item slot columns is stored here
int xPitch = getXPitch();
int yPitch = getYPitch();
int xPadding = getPaddingX();
int yPadding = getPaddingY();
int itemId = itemIds[index];
int itemQuantity = itemQuantities[index];
@@ -335,8 +335,8 @@ public abstract class RSWidgetMixin implements RSWidget
int row = index / columns;
int col = index % columns;
int itemX = rl$x + ((ITEM_SLOT_SIZE + xPitch) * col);
int itemY = rl$y + ((ITEM_SLOT_SIZE + yPitch) * row);
int itemX = rl$x + ((ITEM_SLOT_SIZE + xPadding) * col);
int itemY = rl$y + ((ITEM_SLOT_SIZE + yPadding) * row);
boolean isDragged = isWidgetItemDragged(index);
int dragOffsetX = 0;

View File

@@ -340,10 +340,19 @@ public interface RSWidget extends Widget
void setOriginalWidth(int originalWidth);
@Import("paddingX")
int getXPitch();
int getPaddingX();
@Import("paddingY")
int getYPitch();
int getPaddingY();
@Import("paddingX")
@Override
void setPaddingX(int paddingX);
@Import("paddingY")
@Override
void setPaddingY(int paddingY);
@Import("onOp")
@Override