v0.6.0: fixed item sprite alignment issues
This commit is contained in:
parent
94e3dbcfbc
commit
8ead7fe7be
|
@ -117,27 +117,32 @@ public class ItemSlot extends Button {
|
||||||
protected void layout() {
|
protected void layout() {
|
||||||
super.layout();
|
super.layout();
|
||||||
|
|
||||||
icon.x = x + (width - icon.width) / 2;
|
icon.x = x + (width - icon.width) / 2f;
|
||||||
icon.y = y + (height - icon.height) / 2;
|
icon.y = y + (height - icon.height) / 2f;
|
||||||
|
PixelScene.align(icon);
|
||||||
|
|
||||||
if (topLeft != null) {
|
if (topLeft != null) {
|
||||||
topLeft.x = x;
|
topLeft.x = x;
|
||||||
topLeft.y = y;
|
topLeft.y = y;
|
||||||
|
PixelScene.align(topLeft);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (topRight != null) {
|
if (topRight != null) {
|
||||||
topRight.x = x + (width - topRight.width());
|
topRight.x = x + (width - topRight.width());
|
||||||
topRight.y = y;
|
topRight.y = y;
|
||||||
|
PixelScene.align(topRight);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bottomRight != null) {
|
if (bottomRight != null) {
|
||||||
bottomRight.x = x + (width - bottomRight.width());
|
bottomRight.x = x + (width - bottomRight.width());
|
||||||
bottomRight.y = y + (height - bottomRight.height());
|
bottomRight.y = y + (height - bottomRight.height());
|
||||||
|
PixelScene.align(bottomRight);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bottomRightIcon != null) {
|
if (bottomRightIcon != null) {
|
||||||
bottomRightIcon.x = x + (width - bottomRightIcon.width()) -1;
|
bottomRightIcon.x = x + (width - bottomRightIcon.width()) -1;
|
||||||
bottomRightIcon.y = y + (height - bottomRightIcon.height());
|
bottomRightIcon.y = y + (height - bottomRightIcon.height());
|
||||||
|
PixelScene.align(bottomRightIcon);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -81,6 +81,7 @@ public class IconTitle extends Component {
|
||||||
|
|
||||||
imIcon.x = x + (Math.max(0, 8 - imIcon.width()/2));
|
imIcon.x = x + (Math.max(0, 8 - imIcon.width()/2));
|
||||||
imIcon.y = y + (Math.max(0, 8 - imIcon.height()/2));
|
imIcon.y = y + (Math.max(0, 8 - imIcon.height()/2));
|
||||||
|
PixelScene.align(imIcon);
|
||||||
|
|
||||||
int imWidth = (int)Math.max(imIcon.width(), 16);
|
int imWidth = (int)Math.max(imIcon.width(), 16);
|
||||||
int imHeight = (int)Math.max(imIcon.height(), 16);
|
int imHeight = (int)Math.max(imIcon.height(), 16);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user