Search in sources :

Example 1 with IconTitle

use of com.watabou.pixeldungeon.windows.IconTitle in project pixel-dungeon-remix by NYRDS.

the class GenericInfo method makeInfo.

public static void makeInfo(Window parent, Image icon, String title, int titleColor, String desc) {
    IconTitle titlebar = new IconTitle();
    titlebar.icon(icon);
    titlebar.label(Utils.capitalize(title), titleColor);
    titlebar.setRect(0, 0, WIDTH, 0);
    parent.add(titlebar);
    Text txtInfo = PixelScene.createMultiline(desc, GuiProperties.regularFontSize());
    txtInfo.maxWidth(WIDTH);
    txtInfo.measure();
    txtInfo.setPos(0, 0);
    int wndHeight = (int) Math.min((titlebar.bottom() + txtInfo.height() + 3 * GAP), MAX_HEIGHT);
    parent.resize(WIDTH, wndHeight);
    int scroolZoneHeight = (int) (wndHeight - titlebar.bottom() - GAP * 2);
    ScrollPane list = new ScrollPane(new Component());
    parent.add(list);
    list.setRect(0, titlebar.height() + GAP, WIDTH, scroolZoneHeight);
    Component content = list.content();
    content.clear();
    content.add(txtInfo);
    content.setSize(txtInfo.width(), txtInfo.height());
}
Also used : ScrollPane(com.watabou.pixeldungeon.ui.ScrollPane) Text(com.watabou.noosa.Text) Component(com.watabou.noosa.ui.Component) IconTitle(com.watabou.pixeldungeon.windows.IconTitle)

Aggregations

Text (com.watabou.noosa.Text)1 Component (com.watabou.noosa.ui.Component)1 ScrollPane (com.watabou.pixeldungeon.ui.ScrollPane)1 IconTitle (com.watabou.pixeldungeon.windows.IconTitle)1