Search in sources :

Example 11 with Text

use of com.watabou.noosa.Text in project pixel-dungeon-remix by NYRDS.

the class AmuletScene method create.

@Override
public void create() {
    super.create();
    Text text = null;
    if (!noText) {
        text = createMultiline(TXT, GuiProperties.regularFontSize());
        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, Rankings.gameOver.WIN_AMULET);
            Dungeon.gameOver();
            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) Text(com.watabou.noosa.Text) RedButton(com.watabou.pixeldungeon.ui.RedButton) Image(com.watabou.noosa.Image)

Example 12 with Text

use of com.watabou.noosa.Text in project pixel-dungeon-remix by NYRDS.

the class BadgesScene method create.

@Override
public void create() {
    super.create();
    Music.INSTANCE.play(Assets.THEME, true);
    Music.INSTANCE.volume(1f);
    uiCamera.setVisible(false);
    int w = Camera.main.width;
    int h = Camera.main.height;
    Archs archs = new Archs();
    archs.setSize(w, h);
    add(archs);
    int pw = Math.min(160, w - 6);
    int ph = h - 30;
    NinePatch panel = Chrome.get(Chrome.Type.WINDOW);
    panel.size(pw, ph);
    panel.x = (w - pw) / 2;
    panel.y = (h - ph) / 2;
    add(panel);
    Text title = PixelScene.createText(TXT_TITLE, GuiProperties.titleFontSize());
    title.hardlight(Window.TITLE_COLOR);
    title.measure();
    title.x = align((w - title.width()) / 2);
    title.y = align((panel.y - title.baseLine()) / 2);
    add(title);
    Badges.loadGlobal();
    ScrollPane list = new BadgesList(true);
    add(list);
    list.setRect(panel.x + panel.marginLeft(), panel.y + panel.marginTop(), panel.innerWidth(), panel.innerHeight());
    ExitButton btnExit = new ExitButton();
    btnExit.setPos(Camera.main.width - btnExit.width(), 0);
    add(btnExit);
    fadeIn();
}
Also used : Archs(com.watabou.pixeldungeon.ui.Archs) ExitButton(com.watabou.pixeldungeon.ui.ExitButton) ScrollPane(com.watabou.pixeldungeon.ui.ScrollPane) NinePatch(com.watabou.noosa.NinePatch) BadgesList(com.watabou.pixeldungeon.ui.BadgesList) Text(com.watabou.noosa.Text)

Example 13 with Text

use of com.watabou.noosa.Text in project pixel-dungeon-remix by NYRDS.

the class PixelScene method createText.

public static Text createText(String text, float size) {
    if (!ModdingMode.getClassicTextRenderingMode()) {
        return new SystemText(text, size, false);
    }
    Text result = Text.create(text, chooseFont(size));
    result.Scale().set(scale);
    return result;
}
Also used : Text(com.watabou.noosa.Text) SystemText(com.watabou.noosa.SystemText) SystemText(com.watabou.noosa.SystemText)

Example 14 with Text

use of com.watabou.noosa.Text in project pixel-dungeon-remix by NYRDS.

the class RankingsScene method create.

@Override
public void create() {
    super.create();
    Music.INSTANCE.play(Assets.THEME, true);
    Music.INSTANCE.volume(1f);
    uiCamera.setVisible(false);
    int w = Camera.main.width;
    int h = Camera.main.height;
    Archs archs = new Archs();
    archs.setSize(w, h);
    add(archs);
    Rankings.INSTANCE.load();
    if (Rankings.INSTANCE.records.size() > 0) {
        float rowHeight = PixelDungeon.landscape() ? ROW_HEIGHT_L : ROW_HEIGHT_P;
        float top = align(rowHeight / 2);
        Text title = PixelScene.createText(TXT_TITLE, GuiProperties.titleFontSize());
        title.hardlight(Window.TITLE_COLOR);
        title.measure();
        title.x = align((w - title.width()) / 2);
        title.y = align(top - title.height() - GAP);
        add(title);
        float btnHeight = rowHeight / 2;
        RedButton btnNext = new RedButton(">") {

            @Override
            protected void onClick() {
                super.onClick();
                startFrom += recodrsPerPage;
                if (startFrom > Rankings.TABLE_SIZE - recodrsPerPage) {
                    startFrom = Rankings.TABLE_SIZE - recodrsPerPage;
                }
                if (startFrom > Rankings.INSTANCE.records.size()) {
                    startFrom -= recodrsPerPage;
                }
                switch(PixelDungeon.donated()) {
                    case 0:
                        if (startFrom > 10) {
                            startFrom = 10;
                        }
                        break;
                    case 1:
                        if (startFrom > 25) {
                            startFrom = 25;
                        }
                        break;
                    case 2:
                        if (startFrom > 50) {
                            startFrom = 50;
                        }
                        break;
                }
                createRecords();
            }
        };
        btnNext.setRect(w / 2 + GAP, h - btnHeight, w / 2 - GAP, btnHeight);
        add(btnNext);
        RedButton btnPrev = new RedButton("<") {

            @Override
            protected void onClick() {
                super.onClick();
                startFrom -= recodrsPerPage;
                if (startFrom < 0) {
                    startFrom = 0;
                }
                createRecords();
            }
        };
        btnPrev.setRect(0, h - btnHeight, w / 2 - GAP, btnHeight);
        add(btnPrev);
        createRecords();
        Text label = PixelScene.createText(TXT_TOTAL, GuiProperties.titleFontSize());
        label.hardlight(DEFAULT_COLOR);
        label.measure();
        add(label);
        Text happy = PixelScene.createText(Integer.toString(Rankings.INSTANCE.happyWonNumber), GuiProperties.titleFontSize());
        happy.hardlight(HAPPY_COLOR);
        happy.measure();
        add(happy);
        Text won = PixelScene.createText("/" + Integer.toString(Rankings.INSTANCE.wonNumber), GuiProperties.titleFontSize());
        won.hardlight(Window.TITLE_COLOR);
        won.measure();
        add(won);
        Text total = PixelScene.createText("/" + Rankings.INSTANCE.totalNumber, GuiProperties.titleFontSize());
        total.hardlight(DEFAULT_COLOR);
        total.measure();
        total.x = align((w - total.width()) / 2);
        total.y = align(top + recodrsPerPage * rowHeight + GAP);
        add(total);
        float tw = label.width() + won.width() + happy.width() + total.width();
        label.x = align((w - tw) / 2);
        happy.x = label.x + label.width();
        won.x = happy.x + happy.width();
        total.x = won.x + won.width();
        label.y = happy.y = won.y = total.y = align(top + recodrsPerPage * rowHeight + GAP);
    } else {
        Text title = PixelScene.createText(TXT_NO_GAMES, GuiProperties.titleFontSize());
        title.hardlight(DEFAULT_COLOR);
        title.measure();
        title.x = align((w - title.width()) / 2);
        title.y = align((h - title.height()) / 2);
        add(title);
    }
    ExitButton btnExit = new ExitButton();
    btnExit.setPos(Camera.main.width - btnExit.width(), 0);
    add(btnExit);
    fadeIn();
}
Also used : Archs(com.watabou.pixeldungeon.ui.Archs) ExitButton(com.watabou.pixeldungeon.ui.ExitButton) BitmapText(com.watabou.noosa.BitmapText) Text(com.watabou.noosa.Text) RedButton(com.watabou.pixeldungeon.ui.RedButton)

Example 15 with Text

use of com.watabou.noosa.Text in project pixel-dungeon-remix by NYRDS.

the class TitleScene method create.

@Override
public void create() {
    super.create();
    Music.INSTANCE.play(Assets.THEME, true);
    Music.INSTANCE.volume(1f);
    uiCamera.setVisible(false);
    int w = Camera.main.width;
    int h = Camera.main.height;
    float height = 180;
    Image title = new Image(REMIXED_TITLE);
    add(title);
    title.x = (w - title.width()) / 2;
    title.y = (title.height() * 0.10f) / 2;
    if (PixelDungeon.landscape()) {
        title.y = -(title.height() * 0.05f);
    }
    placeTorch(title.x + title.width / 2 + 3, title.y + title.height / 2 - 3);
    placeTorch(title.x + title.width / 2 - 5, title.y + title.height / 2 + 5);
    placeTorch(title.x + title.width / 2 - 14, title.y + title.height / 2 + 14);
    DashboardItem btnBadges = new DashboardItem(TXT_BADGES, 3) {

        @Override
        protected void onClick() {
            PixelDungeon.switchNoFade(BadgesScene.class);
        }
    };
    btnBadges.setPos(w / 2 - btnBadges.width(), (h + height) / 2 - DashboardItem.SIZE);
    add(btnBadges);
    DashboardItem btnAbout = new DashboardItem(TXT_ABOUT, 1) {

        @Override
        protected void onClick() {
            PixelDungeon.switchNoFade(AboutScene.class);
        }
    };
    btnAbout.setPos(w / 2, (h + height) / 2 - DashboardItem.SIZE);
    add(btnAbout);
    DashboardItem btnPlay = new DashboardItem(TXT_PLAY, 0) {

        @Override
        protected void onClick() {
            PixelDungeon.switchNoFade(StartScene.class);
        }
    };
    btnPlay.setPos(w / 2 - btnPlay.width(), btnAbout.top() - DashboardItem.SIZE);
    add(btnPlay);
    DashboardItem btnHighscores = new DashboardItem(TXT_HIGHSCORES, 2) {

        @Override
        protected void onClick() {
            PixelDungeon.switchNoFade(RankingsScene.class);
        }
    };
    btnHighscores.setPos(w / 2, btnPlay.top());
    add(btnHighscores);
    btnDonate = new DonateButton();
    pleaseSupport = PixelScene.createText(GuiProperties.titleFontSize());
    pleaseSupport.text(btnDonate.getText());
    pleaseSupport.measure();
    pleaseSupport.setPos((w - pleaseSupport.width()) / 2, h - pleaseSupport.height() * 2);
    btnDonate.setPos((w - btnDonate.width()) / 2, pleaseSupport.y - btnDonate.height());
    float dashBaseline = btnDonate.top() - DashboardItem.SIZE;
    if (PixelDungeon.landscape()) {
        btnPlay.setPos(w / 2 - btnPlay.width() * 2, dashBaseline);
        btnHighscores.setPos(w / 2 - btnHighscores.width(), dashBaseline + btnHighscores.height() / 3);
        btnBadges.setPos(w / 2, dashBaseline + btnBadges.height() / 3);
        btnAbout.setPos(btnBadges.right(), dashBaseline);
    } else {
        btnPlay.setPos(w / 2 - btnPlay.width(), btnAbout.top() - DashboardItem.SIZE + 5);
        btnHighscores.setPos(w / 2, btnPlay.top());
        btnBadges.setPos(w / 2 - btnBadges.width(), dashBaseline + 5);
        btnAbout.setPos(w / 2, dashBaseline + 5);
    }
    Archs archs = new Archs();
    archs.setSize(w, h);
    addToBack(archs);
    Text version = Text.createBasicText("v " + Game.version, font1x);
    version.measure();
    version.hardlight(0x888888);
    version.setPos(w - version.width(), h - version.height());
    add(version);
    float freeInternalStorage = Game.getAvailableInternalMemorySize();
    if (freeInternalStorage < 2) {
        Text lowInteralStorageWarning = PixelScene.createMultiline(GuiProperties.regularFontSize());
        lowInteralStorageWarning.text(Game.getVar(R.string.TitleScene_InternalStorageLow));
        lowInteralStorageWarning.measure();
        lowInteralStorageWarning.setPos(0, h - lowInteralStorageWarning.height());
        lowInteralStorageWarning.hardlight(0.95f, 0.1f, 0.1f);
        add(lowInteralStorageWarning);
    }
    PrefsButton btnPrefs = new PrefsButton();
    btnPrefs.setPos(0, 0);
    add(btnPrefs);
    PlayGamesButton btnPlayGames = new PlayGamesButton();
    btnPlayGames.setPos(btnPrefs.right() + 2, 0);
    add(btnPlayGames);
    ModsButton btnMods = new ModsButton();
    btnMods.setPos(0, btnPrefs.bottom() + 2);
    add(btnMods);
    if (PixelDungeon.donated() > 0) {
        PremiumPrefsButton btnPPrefs = new PremiumPrefsButton();
        btnPPrefs.setPos(btnPrefs.right() + 2, 0);
        add(btnPPrefs);
        btnPlayGames.setPos(btnPPrefs.right() + 2, 0);
    }
    ExitButton btnExit = new ExitButton();
    btnExit.setPos(w - btnExit.width(), 0);
    add(btnExit);
    ChangelogButton btnChangelog = new ChangelogButton();
    btnChangelog.setPos(w - btnChangelog.width(), btnExit.bottom() + 2);
    add(btnChangelog);
    StatisticsButton btnStats = new StatisticsButton();
    btnStats.setPos(w - btnStats.width(), btnChangelog.bottom() + 2);
    add(btnStats);
    fadeIn();
}
Also used : PremiumPrefsButton(com.watabou.pixeldungeon.ui.PremiumPrefsButton) ExitButton(com.watabou.pixeldungeon.ui.ExitButton) Text(com.watabou.noosa.Text) Image(com.watabou.noosa.Image) StatisticsButton(com.watabou.pixeldungeon.ui.StatisticsButton) ChangelogButton(com.watabou.pixeldungeon.ui.ChangelogButton) ModsButton(com.watabou.pixeldungeon.ui.ModsButton) PlayGamesButton(com.watabou.pixeldungeon.ui.PlayGamesButton) Archs(com.watabou.pixeldungeon.ui.Archs) PremiumPrefsButton(com.watabou.pixeldungeon.ui.PremiumPrefsButton) PrefsButton(com.watabou.pixeldungeon.ui.PrefsButton) DonateButton(com.watabou.pixeldungeon.ui.DonateButton)

Aggregations

Text (com.watabou.noosa.Text)18 Archs (com.watabou.pixeldungeon.ui.Archs)6 RedButton (com.watabou.pixeldungeon.ui.RedButton)5 Image (com.watabou.noosa.Image)4 ExitButton (com.watabou.pixeldungeon.ui.ExitButton)4 ScrollPane (com.watabou.pixeldungeon.ui.ScrollPane)4 NinePatch (com.watabou.noosa.NinePatch)3 Component (com.watabou.noosa.ui.Component)3 Intent (android.content.Intent)2 Touch (com.watabou.input.Touchscreen.Touch)2 SystemText (com.watabou.noosa.SystemText)2 TouchArea (com.watabou.noosa.TouchArea)2 Flare (com.watabou.pixeldungeon.effects.Flare)2 ItemSprite (com.watabou.pixeldungeon.sprites.ItemSprite)2 Spell (com.nyrds.pixeldungeon.mechanics.spells.Spell)1 BitmapText (com.watabou.noosa.BitmapText)1 Visual (com.watabou.noosa.Visual)1 BadgesList (com.watabou.pixeldungeon.ui.BadgesList)1 ChangelogButton (com.watabou.pixeldungeon.ui.ChangelogButton)1 DonateButton (com.watabou.pixeldungeon.ui.DonateButton)1