public float reqHeight() { return text.baseLine() + 4; } }
public float baseLine(){ return super.baseLine(); }
@Override protected void layout() { icon.x = x; icon.y = PixelScene.align( y + (height - icon.height) / 2 ); label.x = icon.x + icon.width + 2; label.y = PixelScene.align( y + (height - label.baseLine()) / 2 ); }
@Override protected void layout() { sprite.y = PixelScene.align( y + (height - sprite.height) / 2 ); label.x = sprite.x + sprite.width; label.y = PixelScene.align( y + (height - label.baseLine()) / 2 ); }
@Override protected void layout() { final float ty = y + (height - action.baseLine()) / 2; final float w4 = width / 4; action.x = MARGIN; action.y = ty; key1.x = w4 * 2 + (w4 - key1.width()) / 2; key1.y = ty; key2.x = w4 * 3 + (w4 - key2.width()) / 2; key2.y = ty; }
private void placeNumber() { number.x = right() - 11 - number.width(); number.y = y + (height - number.baseLine()) / 2f; PixelScene.align(number); }
private void placeNumber() { number.x = right() - 11 - number.width(); number.y = y + (height - number.baseLine()) / 2f; PixelScene.align(number); }
private void placeNumber() { number.x = right() - 11 - number.width(); number.y = PixelScene.align( y + (height - number.baseLine()) / 2 ); }
@Override protected void layout() { super.layout(); if (secondary.text().length() > 0) { text.y = align( y + (height - text.height() - secondary.baseLine()) / 2 ); secondary.x = align( x + (width - secondary.width()) / 2 ); secondary.y = align( text.y + text.height() ); } else { text.y = align( y + (height - text.baseLine()) / 2 ); } }
@Override protected void layout() { image.x = 0; image.y = Math.max( 0, name.height() + GAP + health.height() - image.height ); name.x = image.width + GAP; name.y = image.height - health.height() - GAP - name.baseLine(); float w = width - image.width - GAP; health.setRect( image.width + GAP, image.height - health.height(), w, health.height() ); buffs.setPos( name.x + name.width() + GAP, name.y + name.baseLine() - BuffIndicator.SIZE ); height = health.bottom(); } }
@Override protected void layout() { super.layout(); btLabel.x = PixelScene.align( x + (width - btLabel.width()) / 2 ); btLabel.y = PixelScene.align( y + (height - btLabel.baseLine()) / 2 ) - 1; if (!selected) { btLabel.y -= 2; } }
@Override protected void layout() { super.layout(); float margin = (height - text.baseLine()) / 2; text.x = PixelScene.align( PixelScene.uiCamera, x + margin ); text.y = PixelScene.align( PixelScene.uiCamera, y + margin ); margin = (height - icon.height) / 2; icon.x = PixelScene.align( PixelScene.uiCamera, x + width - margin - icon.width ); icon.y = PixelScene.align( PixelScene.uiCamera, y + margin ); }
@Override protected void layout() { super.layout(); bg.x = x; bg.y = y; bg.size( width, height ); text.x = x + (int)(width - text.width()) / 2; text.y = y + (int)(height - text.baseLine()) / 2; if (icon != null) { icon.x = x + text.x - icon.width() - 2; icon.y = y + (height - icon.height()) / 2; } };
private float statSlot( Group parent, String label, String value, float pos ) { BitmapText txt = PixelScene.createText( label, 7 ); txt.y = pos; parent.add( txt ); txt = PixelScene.createText( value, 6 ); txt.measure(); txt.x = PixelScene.align( WIDTH * 0.65f ); txt.y = pos; parent.add( txt ); return pos + GAP + txt.baseLine(); } }
private void statSlot( String label, String value ) { BitmapText txt = PixelScene.createText( label, 6 ); txt.y = pos; add( txt ); txt = PixelScene.createText( value, 6 ); txt.measure(); txt.x = PixelScene.align( WIDTH * 0.65f ); txt.y = pos; add( txt ); pos += GAP + txt.baseLine(); }
@Override protected void layout() { super.layout(); name.x = slot.right() + 2; name.y = y + (height - name.baseLine()) / 2; String str = Utils.capitalize( item.name() ); name.text( str ); name.measure(); if (name.width() > width - name.x) { do { str = str.substring( 0, str.length() - 1 ); name.text( str + "..." ); name.measure(); } while (name.width() > width - name.x); } } }
@Override protected void layout() { height = 32; bg.size( width, bg.height ); avatar.x = bg.x + 15 - avatar.width / 2f; avatar.y = bg.y + 16 - avatar.height / 2f; PixelScene.align(avatar); compass.x = avatar.x + avatar.width / 2f - compass.origin.x; compass.y = avatar.y + avatar.height / 2f - compass.origin.y; PixelScene.align(compass); hp.x = shieldedHP.x = rawShielding.x = 30; hp.y = shieldedHP.y = rawShielding.y = 3; bossHP.setPos( 6 + (width - bossHP.width())/2, 20); depth.x = width - 35.5f - depth.width() / 2f; depth.y = 8f - depth.baseLine() / 2f; PixelScene.align(depth); danger.setPos( width - danger.width(), 20 ); buffs.setPos( 31, 9 ); btnJournal.setPos( width - 42, 1 ); btnMenu.setPos( width - btnMenu.width(), 1 ); version.scale.set(PixelScene.align(0.5f)); version.measure(); version.x = width - version.width(); version.y = btnMenu.bottom() + (4 - version.baseLine()); PixelScene.align(version); }
protected void placeTitle( Bag bag, int width ){ RenderedText txtTitle = PixelScene.renderText( title != null ? Messages.titleCase(title) : Messages.titleCase( bag.name() ), 9 ); txtTitle.hardlight( TITLE_COLOR ); txtTitle.x = 1; txtTitle.y = (int)(TITLE_HEIGHT - txtTitle.baseLine()) / 2f - 1; PixelScene.align(txtTitle); add( txtTitle ); ItemSprite gold = new ItemSprite(ItemSpriteSheet.GOLD, null); gold.x = width - gold.width() - 1; gold.y = (TITLE_HEIGHT - gold.height())/2f - 1; PixelScene.align(gold); add(gold); BitmapText amt = new BitmapText( Integer.toString(Dungeon.gold), PixelScene.pixelFont ); amt.hardlight(TITLE_COLOR); amt.measure(); amt.x = width - gold.width() - amt.width() - 2; amt.y = (TITLE_HEIGHT - amt.baseLine())/2f - 1; PixelScene.align(amt); add(amt); }
protected void placeTitle( Bag bag, int width ){ RenderedText txtTitle = PixelScene.renderText( title != null ? Messages.titleCase(title) : Messages.titleCase( bag.name() ), 9 ); txtTitle.hardlight( TITLE_COLOR ); txtTitle.x = 1; txtTitle.y = (int)(TITLE_HEIGHT - txtTitle.baseLine()) / 2f - 1; PixelScene.align(txtTitle); add( txtTitle ); ItemSprite gold = new ItemSprite(ItemSpriteSheet.GOLD, null); gold.x = width - gold.width() - 1; gold.y = (TITLE_HEIGHT - gold.height())/2f - 1; PixelScene.align(gold); add(gold); BitmapText amt = new BitmapText( Integer.toString(Dungeon.gold), PixelScene.pixelFont ); amt.hardlight(TITLE_COLOR); amt.measure(); amt.x = width - gold.width() - amt.width() - 2; amt.y = (TITLE_HEIGHT - amt.baseLine())/2f - 1; PixelScene.align(amt); add(amt); }