public float reqWidth() { float reqWidth = 0; if (icon != null){ reqWidth += icon.width() + 2; } if (text != null && !text.text().equals("")){ reqWidth += text.width() + 2; } return reqWidth; }
public float reqWidth() { float reqWidth = 0; if (icon != null){ reqWidth += icon.width() + 2; } if (text != null && !text.text().equals("")){ reqWidth += text.width() + 2; } return reqWidth; }
@Override protected void layout() { super.layout(); btLabel.x = x + (width - btLabel.width()) / 2; btLabel.y = y + (height - btLabel.baseLine()) / 2 - 1; if (!selected) { btLabel.y -= 2; } PixelScene.align(btLabel); }
@Override protected void layout() { super.layout(); btLabel.x = x + (width - btLabel.width()) / 2; btLabel.y = y + (height - btLabel.baseLine()) / 2 - 1; if (!selected) { btLabel.y -= 2; } PixelScene.align(btLabel); }
@Override protected void layout() { bg.x = x; bg.y = y; slot.setRect( x, y, HEIGHT, HEIGHT ); PixelScene.align(slot); name.x = slot.right() + 2; name.y = y + (height - name.baseLine()) / 2; PixelScene.align(name); String str = Messages.titleCase( item.name() ); name.text( str ); if (name.width() > width - name.x) { do { str = str.substring( 0, str.length() - 1 ); name.text( str + "..." ); } while (name.width() > width - name.x); } super.layout(); }
@Override protected void layout() { super.layout(); image.x = x + (width - image.width()) / 2; image.y = y; align(image); label.x = x + (width - label.width()) / 2; label.y = image.y + image.height() +2; align(label); }
@Override protected void layout() { bg.x = x; bg.y = y; slot.setRect( x, y, HEIGHT, HEIGHT ); PixelScene.align(slot); name.x = slot.right() + 2; name.y = y + (height - name.baseLine()) / 2; PixelScene.align(name); String str = Messages.titleCase( item.name() ); name.text( str ); if (name.width() > width - name.x) { do { str = str.substring( 0, str.length() - 1 ); name.text( str + "..." ); } while (name.width() > width - name.x); } super.layout(); }
@Override protected void layout() { super.layout(); image.x = x + (width - image.width()) / 2; image.y = y; align(image); label.x = x + (width - label.width()) / 2; label.y = image.y + image.height() +2; align(label); }
@Override protected void layout() { image.x = 0; image.y = Math.max( 0, name.height() + health.height() - image.height ); name.x = image.width + GAP; name.y = Math.max( 0, image.height - health.height() - name.height()); float w = width - image.width - GAP; health.setRect(image.width + GAP, name.y + name.height(), w, health.height()); buffs.setPos( name.x + name.width() + GAP-1, name.y + name.baseLine() - BuffIndicator.SIZE-2 ); height = health.bottom(); } }
@Override protected void layout() { image.x = 0; image.y = Math.max( 0, name.height() + health.height() - image.height ); name.x = image.width + GAP; name.y = Math.max( 0, image.height - health.height() - name.height()); float w = width - image.width - GAP; health.setRect(image.width + GAP, name.y + name.height(), w, health.height()); buffs.setPos( name.x + name.width() + GAP-1, name.y + name.baseLine() - BuffIndicator.SIZE-2 ); height = health.bottom(); } }
public PerksTab() { super(); float dotWidth = 0; String[] items = cl.perks(); float pos = MARGIN; for (int i=0; i < items.length; i++) { if (i > 0) { pos += GAP; } RenderedText dot = PixelScene.renderText( "-", 6 ); dot.y = pos; if (dotWidth == 0) { dotWidth = dot.width(); } add( dot ); RenderedTextMultiline item = PixelScene.renderMultiline( items[i], 6 ); item.maxWidth((int)(WIDTH - MARGIN * 2 - dotWidth)); item.setPos(dot.x + dot.width(), pos); add( item ); pos += item.height(); float w = item.width(); if (w > width) { width = w; } } width += MARGIN + dotWidth; height = pos + MARGIN; } }
@Override protected void layout() { super.layout(); bg.x = x; bg.y = y; bg.size( width, height ); float componentWidth = 0; if (icon != null) componentWidth += icon.width() + 2; if (text != null && !text.text().equals("")){ componentWidth += text.width() + 2; text.x = x + (width() - componentWidth)/2f + 1; text.y = y + (height() - text.baseLine()) / 2f; PixelScene.align(text); } if (icon != null) { icon.x = x + (width() + componentWidth)/2f - icon.width() - 1; icon.y = y + (height() - icon.height()) / 2f; PixelScene.align(icon); } }
@Override protected void layout() { super.layout(); bg.x = x; bg.y = y; bg.size( width, height ); float componentWidth = 0; if (icon != null) componentWidth += icon.width() + 2; if (text != null && !text.text().equals("")){ componentWidth += text.width() + 2; text.x = x + (width() - componentWidth)/2f + 1; text.y = y + (height() - text.baseLine()) / 2f; PixelScene.align(text); } if (icon != null) { icon.x = x + (width() + componentWidth)/2f - icon.width() - 1; icon.y = y + (height() - icon.height()) / 2f; PixelScene.align(icon); } }
@Override protected void layout() { super.layout(); avatar.x = x; avatar.y = y + (height - avatar.height() - name.baseLine() - 2)/2f; PixelScene.align(avatar); name.x = x + (avatar.width() - name.width())/2f; name.y = avatar.y + avatar.height() + 2; PixelScene.align(name); heroItem.setPos(x + width - BTN_SIZE, y); heroLoadout.setPos(x + width - BTN_SIZE, heroItem.bottom()); heroMisc.setPos(x + width - BTN_SIZE, heroLoadout.bottom()); heroSubclass.setPos(x + width - BTN_SIZE, heroMisc.bottom()); }
@Override protected void layout() { super.layout(); avatar.x = x; avatar.y = y + (height - avatar.height() - name.baseLine() - 2)/2f; PixelScene.align(avatar); name.x = x + (avatar.width() - name.width())/2f; name.y = avatar.y + avatar.height() + 2; PixelScene.align(name); heroItem.setPos(x + width - BTN_SIZE, y); heroLoadout.setPos(x + width - BTN_SIZE, heroItem.bottom()); heroMisc.setPos(x + width - BTN_SIZE, heroLoadout.bottom()); heroSubclass.setPos(x + width - BTN_SIZE, heroMisc.bottom()); }
energyCost.x = btnCombine.left() + (btnCombine.width() - energyCost.width())/2;
energyCost.x = btnCombine.left() + (btnCombine.width() - energyCost.width())/2;
name.x = x + (width - name.width())/2f; name.y = y + (height - name.baseLine())/2f; align(name);