@Override protected void layout() { bg.x = x; bg.y = y; slot.setRect( x, y, HEIGHT, HEIGHT ); PixelScene.align(slot); name.x = slot.right() + 2; name.y = y + (height - name.baseLine()) / 2; PixelScene.align(name); String str = Messages.titleCase( item.name() ); name.text( str ); if (name.width() > width - name.x) { do { str = str.substring( 0, str.length() - 1 ); name.text( str + "..." ); } while (name.width() > width - name.x); } super.layout(); }
RenderedText word; if (str.startsWith(UNDERSCORE) && str.endsWith(UNDERSCORE)){ word = new RenderedText(str.substring(1, str.length()-1), size); word.hardlight(0xFFFF44); } else { if (str.startsWith(UNDERSCORE)){ highlighting = !highlighting; word = new RenderedText(str.substring(1, str.length()), size); } else if (str.endsWith(UNDERSCORE)) { word = new RenderedText(str.substring(0, str.length()-1), size); } else { word = new RenderedText(str, size); if (highlighting) word.hardlight(0xFFFF44); else if (color != -1) word.hardlight(color); add(word); if (height < word.baseLine()) height = word.baseLine();
public void enable( boolean value ) { active = value; text.alpha( value ? 1.0f : 0.3f ); }
title.hardlight(Window.TITLE_COLOR); title.x = (w - title.width()) / 2f; title.y = (16 - title.baseLine()) / 2f; align(title); add(title); label.hardlight( 0xCCCCCC ); add( label ); won.hardlight( Window.SHPX_COLOR ); add( won ); total.hardlight( 0xCCCCCC ); total.x = (w - total.width()) / 2; total.y = top + pos * rowHeight + GAP; add( total ); float tw = label.width() + won.width() + total.width(); label.x = (w - tw) / 2; won.x = label.x + label.width(); total.x = won.x + won.width(); label.y = won.y = total.y = h - label.height() - GAP; noRec.hardlight( 0xCCCCCC ); noRec.x = (w - noRec.width()) / 2; noRec.y = (h - noRec.height()) / 2; align(noRec); add(noRec);
output.visible = true; energyCost.text( Messages.get(AlchemyScene.class, "cost", cost) ); energyCost.y = btnCombine.top() - energyCost.baseLine(); energyCost.x = btnCombine.left() + (btnCombine.width() - energyCost.width())/2; energyCost.resetColor(); } else { btnCombine.enable(false); energyCost.hardlight(1, 0, 0);
@Override protected void layout() { super.layout(); icon.y = this.y; txt.x = icon.width + GAP; txt.y = pos + (int)(icon.height - txt.baseLine()) / 2; }
newGame = info == null; if (newGame){ name.text( Messages.get(StartScene.class, "new")); name.text(Messages.titleCase(info.subClass.title())); } else { name.text(Messages.titleCase(info.heroClass.title())); name.hardlight(Window.TITLE_COLOR); depth.hardlight(Window.TITLE_COLOR); level.hardlight(Window.TITLE_COLOR); } else { name.resetColor(); depth.resetColor(); level.resetColor();
public LabeledTab( String label ) { super(); btLabel.text( label ); }
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); }
public synchronized void hardlight(int color){ this.color = color; for (RenderedText word : words) { if (word != null) word.hardlight( color ); } }
public void size( int size ){ this.size = size; needsRender = true; measure(this); }