@Override protected void layout() { health.visible = !Float.isNaN( healthLvl ); imIcon.x = x; imIcon.y = y; tfLabel.x = PixelScene.align( PixelScene.uiCamera, imIcon.x + imIcon.width() + GAP ); tfLabel.maxWidth = (int)(width - tfLabel.x); tfLabel.measure(); tfLabel.y = PixelScene.align( PixelScene.uiCamera, imIcon.height > tfLabel.height() ? imIcon.y + (imIcon.height() - tfLabel.baseLine()) / 2 : imIcon.y ); if (health.visible) { health.setRect( tfLabel.x, Math.max( tfLabel.y + tfLabel.height(), imIcon.y + imIcon.height() - health.height() ), tfLabel.maxWidth, 0 ); height = health.bottom(); } else { height = Math.max( imIcon.y + imIcon.height(), tfLabel.y + tfLabel.height() ); } }
@Override protected void layout() { super.layout(); shield.x = x; shield.y = y + (height - shield.height) / 2; position.x = align( shield.x + (shield.width - position.width()) / 2 ); position.y = align( shield.y + (shield.height - position.height()) / 2 + 1 ); if (flare != null) { flare.point( shield.center() ); } floorIcon.x = align( x + width - floorIcon.width * 2 ); floorIcon.y = shield.y; flNumber.x = align( floorIcon.x + (floorIcon.width - flNumber.width()) / 2 ); flNumber.y = align( floorIcon.y + (floorIcon.height - flNumber.height()) / 2 + 1 ); classIcon.x = align( x + width - classIcon.width ); classIcon.y = shield.y; chLevel.x = align( classIcon.x + (classIcon.width - chLevel.width()) / 2 ); chLevel.y = align( classIcon.y + (classIcon.height - chLevel.height()) / 2 + 1 ); desc.x = shield.x + shield.width + GAP; desc.maxWidth = (int)(floorIcon.x - desc.x); desc.measure(); desc.y = position.y + position.baseLine() - desc.baseLine(); }