Search in sources :

Example 6 with BitmapTextMultiline

use of com.watabou.noosa.BitmapTextMultiline in project pixel-dungeon by watabou.

the class AmuletScene method create.

@Override
public void create() {
    super.create();
    BitmapTextMultiline text = null;
    if (!noText) {
        text = createMultiline(TXT, 8);
        text.maxWidth = WIDTH;
        text.measure();
        add(text);
    }
    amulet = new Image(Assets.AMULET);
    add(amulet);
    RedButton btnExit = new RedButton(TXT_EXIT) {

        @Override
        protected void onClick() {
            Dungeon.win(ResultDescriptions.WIN);
            Dungeon.deleteGame(Dungeon.hero.heroClass, true);
            Game.switchScene(noText ? TitleScene.class : RankingsScene.class);
        }
    };
    btnExit.setSize(WIDTH, BTN_HEIGHT);
    add(btnExit);
    RedButton btnStay = new RedButton(TXT_STAY) {

        @Override
        protected void onClick() {
            onBackPressed();
        }
    };
    btnStay.setSize(WIDTH, BTN_HEIGHT);
    add(btnStay);
    float height;
    if (noText) {
        height = amulet.height + LARGE_GAP + btnExit.height() + SMALL_GAP + btnStay.height();
        amulet.x = align((Camera.main.width - amulet.width) / 2);
        amulet.y = align((Camera.main.height - height) / 2);
        btnExit.setPos((Camera.main.width - btnExit.width()) / 2, amulet.y + amulet.height + LARGE_GAP);
        btnStay.setPos(btnExit.left(), btnExit.bottom() + SMALL_GAP);
    } else {
        height = amulet.height + LARGE_GAP + text.height() + LARGE_GAP + btnExit.height() + SMALL_GAP + btnStay.height();
        amulet.x = align((Camera.main.width - amulet.width) / 2);
        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;
        btnExit.setPos((Camera.main.width - btnExit.width()) / 2, text.y + text.height() + LARGE_GAP);
        btnStay.setPos(btnExit.left(), btnExit.bottom() + SMALL_GAP);
    }
    new Flare(8, 48).color(0xFFDDBB, true).show(amulet, 0).angularSpeed = +30;
    fadeIn();
}
Also used : Flare(com.watabou.pixeldungeon.effects.Flare) RedButton(com.watabou.pixeldungeon.ui.RedButton) Image(com.watabou.noosa.Image) BitmapTextMultiline(com.watabou.noosa.BitmapTextMultiline)

Example 7 with BitmapTextMultiline

use of com.watabou.noosa.BitmapTextMultiline in project pixel-dungeon by watabou.

the class GameLog method layout.

@Override
protected void layout() {
    float pos = y;
    for (int i = length - 1; i >= 0; i--) {
        BitmapTextMultiline entry = (BitmapTextMultiline) members.get(i);
        entry.maxWidth = (int) width;
        entry.measure();
        entry.x = x;
        entry.y = pos - entry.height();
        pos -= entry.height();
    }
}
Also used : BitmapTextMultiline(com.watabou.noosa.BitmapTextMultiline)

Aggregations

BitmapTextMultiline (com.watabou.noosa.BitmapTextMultiline)7 Image (com.watabou.noosa.Image)3 Flare (com.watabou.pixeldungeon.effects.Flare)2 ItemSprite (com.watabou.pixeldungeon.sprites.ItemSprite)2 Archs (com.watabou.pixeldungeon.ui.Archs)2 ExitButton (com.watabou.pixeldungeon.ui.ExitButton)2 Intent (android.content.Intent)1 Touch (com.watabou.input.Touchscreen.Touch)1 BitmapText (com.watabou.noosa.BitmapText)1 Group (com.watabou.noosa.Group)1 TouchArea (com.watabou.noosa.TouchArea)1 HeroClass (com.watabou.pixeldungeon.actors.hero.HeroClass)1 RedButton (com.watabou.pixeldungeon.ui.RedButton)1 WndOptions (com.watabou.pixeldungeon.windows.WndOptions)1 Callback (com.watabou.utils.Callback)1