@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() ); } }
public TutorialItem( String text, int index, int width ) { super(); icon.frame( film.get( index ) ); label.text( text ); label.maxWidth = width - (int)icon.width() - GAP; label.measure(); height = Math.max( icon.height(), label.height() ) + GAP; }
public WndMessage( String text ) { super(); BitmapTextMultiline info = PixelScene.createMultiline( text, 6 ); info.maxWidth = (YetAnotherPixelDungeon.landscape() ? WIDTH_L : WIDTH_P) - MARGIN * 2; info.measure(); info.x = info.y = MARGIN; add( info ); resize( (int)info.width() + MARGIN * 2, (int)info.height() + MARGIN * 2 ); } }
public WndStory( String text ) { super( 0, 0, Chrome.get( Chrome.Type.SCROLL ) ); tf = PixelScene.createMultiline( text, 7 ); tf.maxWidth = WIDTH - MARGIN * 2; tf.measure(); tf.ra = bgR; tf.ga = bgG; tf.ba = bgB; tf.rm = -bgR; tf.gm = -bgG; tf.bm = -bgB; tf.x = MARGIN; add( tf ); add( new TouchArea( chrome ) { @Override protected void onClick( Touch touch ) { hide(); } } ); resize( (int)(tf.width() + MARGIN * 2), (int)Math.min( tf.height(), 180 ) ); }
public HistoryTab() { super(); String[] items = cl.history(); float pos = MARGIN; for (int i=0; i < items.length; i++) { if (i > 0) { pos += GAP; } BitmapTextMultiline item = PixelScene.createMultiline( items[i], 6 ); item.x = MARGIN; item.y = pos; item.maxWidth = WIDTH - MARGIN * 2; item.measure(); add( item ); pos += item.height(); float w = item.width(); if (w > width) { width = w; } } width += MARGIN; height = pos + MARGIN; } }
public void text( String value, int maxWidth ) { Highlighter hl = new Highlighter( value ); normal.text( hl.text ); normal.maxWidth = maxWidth; normal.measure(); if (hl.isHighlighted()) { normal.mask = hl.inverted(); highlighted.text( hl.text ); highlighted.maxWidth = maxWidth; highlighted.measure(); highlighted.mask = hl.mask; highlighted.visible = true; } else { highlighted.visible = false; } width = normal.width(); height = normal.height(); }
public void text( String value, int maxWidth ) { Highlighter hl = new Highlighter( value ); normal.text( hl.text ); normal.maxWidth = maxWidth; normal.measure(); if (hl.isHighlighted()) { normal.mask = hl.inverted(); highlighted.text( hl.text ); highlighted.maxWidth = maxWidth; highlighted.measure(); highlighted.mask = hl.mask; highlighted.visible = true; } else { highlighted.visible = false; } width = normal.width(); height = normal.height(); }
add( item ); pos += item.height(); float w = item.width(); if (w > maxWidth) {
height = normal.height() + GAP;
add( item ); pos += item.height(); float w = item.width(); if (w > maxWidth) {
pos += GAP_Y + icon.height + basicDesc.height();
add( item ); pos += item.height(); float w = item.width(); if (w > width) {
public WndInfoPlant( Plant plant ) { super(); IconTitle titlebar = new IconTitle(); titlebar.icon( new PlantSprite( plant.image ) ); titlebar.label( plant.plantName ); titlebar.setRect( 0, 0, WIDTH, 0 ); add( titlebar ); BitmapTextMultiline info = PixelScene.createMultiline( 6 ); add( info ); info.text( plant.desc() ); info.maxWidth = WIDTH; info.measure(); info.x = titlebar.left(); info.y = titlebar.bottom() + GAP; resize( WIDTH, (int)(info.y + info.height()) ); } }
resize( width, (int)(normal.y + normal.height()) );
height = normal.y + normal.height() + MARGIN; width = normal.x + normal.width() + MARGIN;
resize( width, (int)(normal.y + normal.height()) );
btnBattle.setRect( 0, message.y + message.height() + GAP, WIDTH, BTN_HEIGHT ); add( btnBattle );
btnWeapon.setRect( 0, message.y + message.height() + GAP, WIDTH, BTN_HEIGHT ); add( btnWeapon );