private void newLine( String str, float width ) { BitmapText txt = new BitmapText( curLine.toString(), font ); txt.scale.set( scale.x ); lines.add( txt ); curLine = new StringBuilder( str ); curLineWidth = width; }
@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 public void update() { super.update(); if (visible) { time -= Game.elapsed; if (time > 0) { tf.alpha( time > TIME / 2 ? 1f : time * 2 / TIME ); } else { visible = false; } } if (Dungeon.gold != lastValue) { lastValue = Dungeon.gold; tf.text( Integer.toString( lastValue ) ); tf.measure(); visible = true; time = TIME; layout(); } } }
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); }
@Override protected void layout() { panel.x = this.x; panel.y = this.y; panel.alpha(alpha); panel.visible = updateAvailable || !quiet; updateMessage.x = panel.x+panel.marginLeft(); updateMessage.y = panel.y+panel.marginTop(); updateMessage.measure(); updateMessage.alpha(alpha); updateMessage.visible = updateAvailable || !quiet; panel.size( panel.marginHor()+updateMessage.width(), panel.marginVer()+updateMessage.height()-1); this.width = panel.width(); this.height = panel.height(); }
add( bossHP ); level = new BitmapText( PixelScene.pixelFont); level.hardlight( 0xFFEBA4 ); add( level ); depth = new BitmapText( Integer.toString( Dungeon.depth ), PixelScene.pixelFont); depth.hardlight( 0xCACFC2 ); depth.measure(); add( depth ); version = new BitmapText( "v" + Game.version, PixelScene.pixelFont); version.alpha( 0.5f ); add(version);
@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 ); } }
public WndChangelog() { super(); if (YetAnotherPixelDungeon.landscape()) { resize( WIDTH_L, HEIGHT_L ); } else { resize( WIDTH_P, HEIGHT_P ); } txtTitle = PixelScene.createText( TXT_TITLE, 9 ); txtTitle.hardlight( Window.TITLE_COLOR ); txtTitle.measure(); txtTitle.x = PixelScene.align( PixelScene.uiCamera, (width - txtTitle.width() ) / 2 ); add( txtTitle ); list = new ScrollPane( new ChangelogItem( TXT_DESCR, width, txtTitle.height() ) ); add( list ); list.setRect( 0, txtTitle.height(), width, height - txtTitle.height() ); list.scrollTo( 0, 0 ); }
@Override protected void createChildren() { tf = new BitmapText( PixelScene.pixelFont); tf.hardlight( 0xFFFF00 ); add( tf ); visible = false; }
public arrow( Image icon, int count ){ super( icon ); text = new BitmapText( Integer.toString(count), PixelScene.pixelFont); text.measure(); add(text); }
@Override public void draw() { super.draw(); NoosaScript script = NoosaScript.get(); font.texture.bind(); if (dirty) { updateVertices(); } script.camera( camera() ); script.uModel.valueM4( matrix ); script.lighting( rm, gm, bm, am, ra, ga, ba, aa ); script.drawQuadSet( quads, realLength ); }
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(); } }
public float reqHeight() { return text.baseLine() + 4; } }
public GameButton( String primary ) { super( primary ); this.secondary.text(null ); }