@Override protected void layout() { icon.x = width - icon.width; depth.x = icon.x - 1 - depth.width(); depth.y = PixelScene.align(y + (height - depth.height()) / 2); icon.y = depth.y - 1; feature.y = PixelScene.align(depth.y + depth.baseLine() - feature.baseLine()); }
public WndJournal() { super(); resize(WIDTH, ShatteredPixelDungeon.landscape() ? HEIGHT_L : 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); Component content = new Component(); Collections.sort(Journal.records); float pos = 0; for (Journal.Record rec : Journal.records) { ListItem item = new ListItem(rec.feature, rec.depth); item.setRect(0, pos, WIDTH, ITEM_HEIGHT); content.add(item); pos += item.height(); } content.setSize(WIDTH, pos); list = new ScrollPane(content); add(list); list.setRect(0, txtTitle.height(), WIDTH, height - txtTitle.height()); }