v0.6.0: fixed item sprite alignment issues

This commit is contained in:
Evan Debenham 2017-03-26 15:10:49 -04:00
parent 94e3dbcfbc
commit 8ead7fe7be
2 changed files with 8 additions and 2 deletions

View File

@ -117,27 +117,32 @@ public class ItemSlot extends Button {
protected void layout() {
super.layout();
icon.x = x + (width - icon.width) / 2;
icon.y = y + (height - icon.height) / 2;
icon.x = x + (width - icon.width) / 2f;
icon.y = y + (height - icon.height) / 2f;
PixelScene.align(icon);
if (topLeft != null) {
topLeft.x = x;
topLeft.y = y;
PixelScene.align(topLeft);
}
if (topRight != null) {
topRight.x = x + (width - topRight.width());
topRight.y = y;
PixelScene.align(topRight);
}
if (bottomRight != null) {
bottomRight.x = x + (width - bottomRight.width());
bottomRight.y = y + (height - bottomRight.height());
PixelScene.align(bottomRight);
}
if (bottomRightIcon != null) {
bottomRightIcon.x = x + (width - bottomRightIcon.width()) -1;
bottomRightIcon.y = y + (height - bottomRightIcon.height());
PixelScene.align(bottomRightIcon);
}
}

View File

@ -81,6 +81,7 @@ public class IconTitle extends Component {
imIcon.x = x + (Math.max(0, 8 - imIcon.width()/2));
imIcon.y = y + (Math.max(0, 8 - imIcon.height()/2));
PixelScene.align(imIcon);
int imWidth = (int)Math.max(imIcon.width(), 16);
int imHeight = (int)Math.max(imIcon.height(), 16);