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(); }
float w = item.width(); if (w > maxWidth) { maxWidth = w;
float w = item.width(); if (w > maxWidth) { maxWidth = w;
text1.maxWidth = Math.min( Camera.main.width, 120 ); text1.measure(); text1.x = align(landscape ? (Camera.main.width / 2 - text1.width()) / 2 : (Camera.main.width - text1.width()) / 2); text1.y = align( landscape ? (Camera.main.height - text1.height()) / 2 : (Camera.main.height / 2 - text1.height()) / 2 ) + 8; add(text1); title1.hardlight(Window.TITLE_COLOR); title1.measure(); title1.x = align(landscape ? (Camera.main.width / 2 - title1.width()) / 2 : (Camera.main.width - title1.width()) / 2); title1.y = text1.y - title1.height; add(title1); text2.maxWidth = Math.min(Camera.main.width, 120); text2.measure(); text2.x = align( landscape ? (Camera.main.width / 2 - text2.width()) / 2 + Camera.main.width / 2 : (Camera.main.width - text2.width()) / 2); text2.y = align( landscape ? (Camera.main.height - text2.height()) / 2 : (Camera.main.height / 2 - text2.height()) / 2 + Camera.main.height / 2 ) + 8; add(text2); title2.hardlight(Window.TITLE_COLOR); title2.measure(); title2.x = align( landscape ? (Camera.main.width / 2 - title2.width()) / 2 + Camera.main.width / 2 : (Camera.main.width - title2.width()) / 2); title2.y = text2.y - title2.height;
float w = item.width(); if (w > width) { width = w;
info.measure(); float w = Math.max( icon.width(), info.width() ) + MARGIN * 2;
showDifficulty.maxWidth = WIDTH - GAP * 2; showDifficulty.measure(); showDifficulty.x = ( WIDTH - showDifficulty.width() ) / 2 + GAP; showDifficulty.y = pos + ( BTN_HEIGHT / 2 - showDifficulty.height() ) / 2 + GAP * 2; add(showDifficulty); showVersion.maxWidth = WIDTH - GAP * 2; showVersion.measure(); showVersion.x = ( WIDTH - showVersion.width() ) / 2 + GAP; showVersion.y = pos + ( BTN_HEIGHT - showVersion.height() / 2 ) / 2 + GAP * 2; add(showVersion);
width = normal.x + normal.width() + MARGIN;
amulet.y = align( (Camera.main.height - height) / 2 ); text.x = align( (Camera.main.width - text.width()) / 2 ); text.y = amulet.y + amulet.height + LARGE_GAP;