Search in sources :

Example 1 with RenderedTextMultiline

use of com.shatteredpixel.shatteredpixeldungeon.ui.RenderedTextMultiline in project shattered-pixel-dungeon-gdx by 00-Evan.

the class AboutScene method create.

@Override
public void create() {
    super.create();
    final float colWidth = Camera.main.width / (SPDSettings.landscape() ? 2 : 1);
    final float colTop = (Camera.main.height / 2) - (SPDSettings.landscape() ? 30 : 90);
    final float wataOffset = SPDSettings.landscape() ? colWidth : 0;
    Image shpx = Icons.SHPX.get();
    shpx.x = (colWidth - shpx.width()) / 2;
    shpx.y = colTop;
    align(shpx);
    add(shpx);
    new Flare(7, 64).color(0x225511, true).show(shpx, 0).angularSpeed = +20;
    RenderedText shpxtitle = renderText(TTL_SHPX, 8);
    shpxtitle.hardlight(Window.SHPX_COLOR);
    add(shpxtitle);
    shpxtitle.x = (colWidth - shpxtitle.width()) / 2;
    shpxtitle.y = shpx.y + shpx.height + 5;
    align(shpxtitle);
    RenderedTextMultiline shpxtext = renderMultiline(TXT_SHPX, 8);
    shpxtext.maxWidth((int) Math.min(colWidth, 120));
    add(shpxtext);
    shpxtext.setPos((colWidth - shpxtext.width()) / 2, shpxtitle.y + shpxtitle.height() + 12);
    align(shpxtext);
    RenderedTextMultiline shpxlink = renderMultiline(LNK_SHPX, 8);
    shpxlink.maxWidth(shpxtext.maxWidth());
    shpxlink.hardlight(Window.SHPX_COLOR);
    add(shpxlink);
    shpxlink.setPos((colWidth - shpxlink.width()) / 2, shpxtext.bottom() + 6);
    align(shpxlink);
    TouchArea shpxhotArea = new TouchArea(shpxlink.left(), shpxlink.top(), shpxlink.width(), shpxlink.height()) {

        @Override
        protected void onClick(NoosaInputProcessor.Touch touch) {
            Gdx.net.openURI("http://" + LNK_SHPX);
        }
    };
    add(shpxhotArea);
    Image wata = Icons.WATA.get();
    wata.x = wataOffset + (colWidth - wata.width()) / 2;
    wata.y = SPDSettings.landscape() ? colTop : shpxlink.top() + wata.height + 20;
    align(wata);
    add(wata);
    new Flare(7, 64).color(0x112233, true).show(wata, 0).angularSpeed = +20;
    RenderedText wataTitle = renderText(TTL_WATA, 8);
    wataTitle.hardlight(Window.TITLE_COLOR);
    add(wataTitle);
    wataTitle.x = wataOffset + (colWidth - wataTitle.width()) / 2;
    wataTitle.y = wata.y + wata.height + 11;
    align(wataTitle);
    RenderedTextMultiline wataText = renderMultiline(TXT_WATA, 8);
    wataText.maxWidth((int) Math.min(colWidth, 120));
    add(wataText);
    wataText.setPos(wataOffset + (colWidth - wataText.width()) / 2, wataTitle.y + wataTitle.height() + 12);
    align(wataText);
    RenderedTextMultiline wataLink = renderMultiline(LNK_WATA, 8);
    wataLink.maxWidth((int) Math.min(colWidth, 120));
    wataLink.hardlight(Window.TITLE_COLOR);
    add(wataLink);
    wataLink.setPos(wataOffset + (colWidth - wataLink.width()) / 2, wataText.bottom() + 6);
    align(wataLink);
    TouchArea hotArea = new TouchArea(wataLink.left(), wataLink.top(), wataLink.width(), wataLink.height()) {

        @Override
        protected void onClick(NoosaInputProcessor.Touch touch) {
            Gdx.net.openURI("http://" + LNK_WATA);
        }
    };
    add(hotArea);
    Archs archs = new Archs();
    archs.setSize(Camera.main.width, Camera.main.height);
    addToBack(archs);
    ExitButton btnExit = new ExitButton();
    btnExit.setPos(Camera.main.width - btnExit.width(), 0);
    add(btnExit);
    fadeIn();
}
Also used : Flare(com.shatteredpixel.shatteredpixeldungeon.effects.Flare) TouchArea(com.watabou.noosa.TouchArea) Archs(com.shatteredpixel.shatteredpixeldungeon.ui.Archs) ExitButton(com.shatteredpixel.shatteredpixeldungeon.ui.ExitButton) RenderedText(com.watabou.noosa.RenderedText) RenderedTextMultiline(com.shatteredpixel.shatteredpixeldungeon.ui.RenderedTextMultiline) Image(com.watabou.noosa.Image)

Example 2 with RenderedTextMultiline

use of com.shatteredpixel.shatteredpixeldungeon.ui.RenderedTextMultiline in project shattered-pixel-dungeon-gdx by 00-Evan.

the class WndInfoItem method fillFields.

private void fillFields(int image, ItemSprite.Glowing glowing, int titleColor, String title, String info) {
    int width = SPDSettings.landscape() ? WIDTH_L : WIDTH_P;
    IconTitle titlebar = new IconTitle();
    titlebar.icon(new ItemSprite(image, glowing));
    titlebar.label(Messages.titleCase(title), titleColor);
    titlebar.setRect(0, 0, width, 0);
    add(titlebar);
    RenderedTextMultiline txtInfo = PixelScene.renderMultiline(info, 6);
    txtInfo.maxWidth(width);
    txtInfo.setPos(titlebar.left(), titlebar.bottom() + GAP);
    add(txtInfo);
    resize(width, (int) (txtInfo.top() + txtInfo.height()));
}
Also used : RenderedTextMultiline(com.shatteredpixel.shatteredpixeldungeon.ui.RenderedTextMultiline) ItemSprite(com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSprite)

Example 3 with RenderedTextMultiline

use of com.shatteredpixel.shatteredpixeldungeon.ui.RenderedTextMultiline in project shattered-pixel-dungeon-gdx by 00-Evan.

the class AmuletScene method create.

@Override
public void create() {
    super.create();
    RenderedTextMultiline text = null;
    if (!noText) {
        text = renderMultiline(Messages.get(this, "text"), 8);
        text.maxWidth(WIDTH);
        add(text);
    }
    amulet = new Image(Assets.AMULET);
    add(amulet);
    RedButton btnExit = new RedButton(Messages.get(this, "exit")) {

        @Override
        protected void onClick() {
            Dungeon.win(Amulet.class);
            Dungeon.deleteGame(GamesInProgress.curSlot, true);
            Game.switchScene(RankingsScene.class);
        }
    };
    btnExit.setSize(WIDTH, BTN_HEIGHT);
    add(btnExit);
    RedButton btnStay = new RedButton(Messages.get(this, "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 = (Camera.main.width - amulet.width) / 2;
        amulet.y = (Camera.main.height - height) / 2;
        align(amulet);
        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 = (Camera.main.width - amulet.width) / 2;
        amulet.y = (Camera.main.height - height) / 2;
        align(amulet);
        text.setPos((Camera.main.width - text.width()) / 2, amulet.y + amulet.height + LARGE_GAP);
        align(text);
        btnExit.setPos((Camera.main.width - btnExit.width()) / 2, text.top() + 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.shatteredpixel.shatteredpixeldungeon.effects.Flare) RenderedTextMultiline(com.shatteredpixel.shatteredpixeldungeon.ui.RenderedTextMultiline) RedButton(com.shatteredpixel.shatteredpixeldungeon.ui.RedButton) Image(com.watabou.noosa.Image)

Example 4 with RenderedTextMultiline

use of com.shatteredpixel.shatteredpixeldungeon.ui.RenderedTextMultiline in project shattered-pixel-dungeon-gdx by 00-Evan.

the class WelcomeScene method create.

@Override
public void create() {
    super.create();
    final int previousVersion = SPDSettings.version();
    if (ShatteredPixelDungeon.versionCode == previousVersion) {
        ShatteredPixelDungeon.switchNoFade(TitleScene.class);
        return;
    }
    uiCamera.visible = false;
    int w = Camera.main.width;
    int h = Camera.main.height;
    Image title = BannerSprites.get(BannerSprites.Type.PIXEL_DUNGEON);
    title.brightness(0.6f);
    add(title);
    float topRegion = Math.max(95f, h * 0.45f);
    title.x = (w - title.width()) / 2f;
    if (SPDSettings.landscape())
        title.y = (topRegion - title.height()) / 2f;
    else
        title.y = 16 + (topRegion - title.height() - 16) / 2f;
    align(title);
    Image signs = new Image(BannerSprites.get(BannerSprites.Type.PIXEL_DUNGEON_SIGNS)) {

        private float time = 0;

        @Override
        public void update() {
            super.update();
            am = Math.max(0f, (float) Math.sin(time += Game.elapsed));
            if (time >= 1.5f * Math.PI)
                time = 0;
        }

        @Override
        public void draw() {
            Blending.setLightMode();
            super.draw();
            Blending.setNormalMode();
        }
    };
    signs.x = title.x + (title.width() - signs.width()) / 2f;
    signs.y = title.y;
    add(signs);
    DarkRedButton okay = new DarkRedButton(Messages.get(this, "continue")) {

        @Override
        protected void onClick() {
            super.onClick();
            if (previousVersion == 0) {
                SPDSettings.version(ShatteredPixelDungeon.versionCode);
                WelcomeScene.this.add(new WndStartGame(1));
            } else {
                updateVersion(previousVersion);
                ShatteredPixelDungeon.switchScene(TitleScene.class);
            }
        }
    };
    if (previousVersion != 0) {
        DarkRedButton changes = new DarkRedButton(Messages.get(this, "changelist")) {

            @Override
            protected void onClick() {
                super.onClick();
                updateVersion(previousVersion);
                ShatteredPixelDungeon.switchScene(ChangesScene.class);
            }
        };
        okay.setRect(title.x, h - 20, (title.width() / 2) - 2, 16);
        okay.textColor(0xBBBB33);
        add(okay);
        changes.setRect(okay.right() + 2, h - 20, (title.width() / 2) - 2, 16);
        changes.textColor(0xBBBB33);
        add(changes);
    } else {
        okay.setRect(title.x, h - 20, title.width(), 16);
        okay.textColor(0xBBBB33);
        add(okay);
    }
    RenderedTextMultiline text = PixelScene.renderMultiline(6);
    String message;
    if (previousVersion == 0) {
        message = Messages.get(this, "welcome_msg");
    } else if (previousVersion <= ShatteredPixelDungeon.versionCode) {
        if (previousVersion < LATEST_UPDATE) {
            message = Messages.get(this, "update_intro");
            message += "\n\n" + Messages.get(this, "update_msg");
        } else {
            // TODO: change the messages here in accordance with the type of patch.
            message = Messages.get(this, "patch_intro");
            message += "\n\n" + Messages.get(this, "patch_bugfixes");
            message += "\n" + Messages.get(this, "patch_translations");
            message += "\n" + Messages.get(this, "patch_balance");
        }
    } else {
        message = Messages.get(this, "what_msg");
    }
    text.text(message, w - 20);
    float textSpace = h - title.y - (title.height() - 10) - okay.height() - 2;
    text.setPos((w - text.width()) / 2f, title.y + (title.height() - 10) + ((textSpace - text.height()) / 2));
    add(text);
}
Also used : WndStartGame(com.shatteredpixel.shatteredpixeldungeon.windows.WndStartGame) RenderedTextMultiline(com.shatteredpixel.shatteredpixeldungeon.ui.RenderedTextMultiline) Image(com.watabou.noosa.Image)

Example 5 with RenderedTextMultiline

use of com.shatteredpixel.shatteredpixeldungeon.ui.RenderedTextMultiline in project shattered-pixel-dungeon-gdx by 00-Evan.

the class WndTradeItem method createDescription.

private float createDescription(Item item, boolean forSale) {
    // Title
    IconTitle titlebar = new IconTitle();
    titlebar.icon(new ItemSprite(item));
    titlebar.label(forSale ? Messages.get(this, "sale", item.toString(), price(item)) : Messages.titleCase(item.toString()));
    titlebar.setRect(0, 0, WIDTH, 0);
    add(titlebar);
    // Upgraded / degraded
    if (item.levelKnown) {
        if (item.level() < 0) {
            titlebar.color(ItemSlot.DEGRADED);
        } else if (item.level() > 0) {
            titlebar.color(ItemSlot.UPGRADED);
        }
    }
    // Description
    RenderedTextMultiline info = PixelScene.renderMultiline(item.info(), 6);
    info.maxWidth(WIDTH);
    info.setPos(titlebar.left(), titlebar.bottom() + GAP);
    add(info);
    return info.bottom();
}
Also used : RenderedTextMultiline(com.shatteredpixel.shatteredpixeldungeon.ui.RenderedTextMultiline) ItemSprite(com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSprite)

Aggregations

RenderedTextMultiline (com.shatteredpixel.shatteredpixeldungeon.ui.RenderedTextMultiline)5 Image (com.watabou.noosa.Image)3 Flare (com.shatteredpixel.shatteredpixeldungeon.effects.Flare)2 ItemSprite (com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSprite)2 Archs (com.shatteredpixel.shatteredpixeldungeon.ui.Archs)1 ExitButton (com.shatteredpixel.shatteredpixeldungeon.ui.ExitButton)1 RedButton (com.shatteredpixel.shatteredpixeldungeon.ui.RedButton)1 WndStartGame (com.shatteredpixel.shatteredpixeldungeon.windows.WndStartGame)1 RenderedText (com.watabou.noosa.RenderedText)1 TouchArea (com.watabou.noosa.TouchArea)1