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 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 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 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; } }
@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() ); } }
item.y = pos; item.maxWidth = (int)(WIDTH - MARGIN * 2 - dotWidth); item.measure(); add( item );
item.y = pos; item.maxWidth = (int)(WIDTH - MARGIN * 2 - dotWidth); item.measure(); add( item );
item.y = pos; item.maxWidth = (int)(WIDTH - MARGIN * 2 - dotWidth); item.measure(); add( item );
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()) ); } }
@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(); }
message.measure(); message.y = titlebar.bottom() + GAP; add( message );
message.measure(); message.y = titlebar.bottom() + GAP; add( message );