Search in sources :

Example 56 with Image

use of com.watabou.noosa.Image 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 57 with Image

use of com.watabou.noosa.Image 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)

Example 58 with Image

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

the class BuffIndicator method layout.

@Override
protected void layout() {
    clear();
    SparseArray<Image> newIcons = new SparseArray<>();
    for (Buff buff : ch.buffs()) {
        int icon = buff.icon();
        if (icon != NONE) {
            Image img = new Image(texture);
            img.frame(film.get(icon));
            img.x = x + members.size() * (SIZE + 2);
            img.y = y;
            add(img);
            newIcons.put(icon, img);
        }
    }
    for (Integer key : icons.keyArray()) {
        if (newIcons.get(key) == null) {
            Image icon = icons.get(key);
            icon.origin.set(SIZE / 2);
            add(icon);
            add(new AlphaTweener(icon, 0, 0.6f) {

                @Override
                protected void updateValues(float progress) {
                    super.updateValues(progress);
                    image.Scale().set(1 + 5 * progress);
                }
            });
        }
    }
    icons = newIcons;
}
Also used : SparseArray(com.watabou.utils.SparseArray) AlphaTweener(com.watabou.noosa.tweeners.AlphaTweener) Image(com.watabou.noosa.Image) Buff(com.watabou.pixeldungeon.actors.buffs.Buff)

Example 59 with Image

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

the class WndHeroSpells method addSpell.

private float addSpell(String spellName, final Hero hero, float yPos, int i) {
    final Spell spell = SpellFactory.getSpellByName(spellName);
    if (spell == null || spell.level() > hero.magicLvl()) {
        return yPos;
    }
    int xPos = 0;
    if (i % 2 == 0) {
        xPos = width - 48 - MARGIN * 2;
    }
    Text txtName;
    txtName = PixelScene.createText(spell.name(), GuiProperties.titleFontSize());
    txtName.measure();
    txtName.x = xPos;
    txtName.y = yPos;
    add(txtName);
    Image icon = spell.image();
    icon.frame(spell.film.get(spell.imageIndex));
    icon.y = txtName.bottom();
    icon.x = xPos;
    add(icon);
    SimpleButton btnCast = new SimpleButton(Icons.get(Icons.BTN_TARGET)) {

        protected void onClick() {
            hide();
            spell.cast(hero);
        }
    };
    btnCast.setRect(icon.x + icon.width() + MARGIN, icon.y, 16, 15);
    add(btnCast);
    SimpleButton btnInfo = new SimpleButton(Icons.get(Icons.BTN_QUESTION)) {

        protected void onClick() {
            hide();
            GameScene.show(new WndSpellInfo(hero, spell));
        }
    };
    btnInfo.setRect(icon.x + icon.width() + MARGIN, btnCast.bottom() + MARGIN, 16, 15);
    add(btnInfo);
    Text txtCost;
    txtCost = PixelScene.createText(Game.getVar(R.string.Mana_Cost) + spell.spellCost(), GuiProperties.titleFontSize());
    txtCost.measure();
    txtCost.x = xPos;
    txtCost.y = icon.bottom();
    add(txtCost);
    if (xPos == 0) {
        return yPos;
    }
    return txtCost.bottom() + MARGIN;
}
Also used : SimpleButton(com.watabou.pixeldungeon.ui.SimpleButton) Text(com.watabou.noosa.Text) Image(com.watabou.noosa.Image) Spell(com.nyrds.pixeldungeon.mechanics.spells.Spell)

Example 60 with Image

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

the class HealthIndicator method createChildren.

@Override
protected void createChildren() {
    bg = new Image(TextureCache.createSolid(0xFFcc0000));
    bg.Scale().y = HEIGHT;
    add(bg);
    level = new Image(TextureCache.createSolid(0xFF00cc00));
    level.Scale().y = HEIGHT;
    add(level);
}
Also used : Image(com.watabou.noosa.Image)

Aggregations

Image (com.watabou.noosa.Image)63 TouchArea (com.watabou.noosa.TouchArea)10 Group (com.watabou.noosa.Group)8 Archs (com.watabou.pixeldungeon.ui.Archs)8 Touch (com.watabou.input.Touchscreen.Touch)7 BitmapText (com.watabou.noosa.BitmapText)6 Emitter (com.watabou.noosa.particles.Emitter)6 AlphaTweener (com.watabou.noosa.tweeners.AlphaTweener)6 ExitButton (com.watabou.pixeldungeon.ui.ExitButton)6 Archs (com.shatteredpixel.shatteredpixeldungeon.ui.Archs)4 NinePatch (com.watabou.noosa.NinePatch)4 Text (com.watabou.noosa.Text)4 Flare (com.watabou.pixeldungeon.effects.Flare)4 Point (com.watabou.utils.Point)4 ExitButton (com.shatteredpixel.shatteredpixeldungeon.ui.ExitButton)3 NoosaInputProcessor (com.watabou.input.NoosaInputProcessor)3 TextureFilm (com.watabou.noosa.TextureFilm)3 RedButton (com.watabou.pixeldungeon.ui.RedButton)3 RectF (android.graphics.RectF)2 Flare (com.shatteredpixel.shatteredpixeldungeon.effects.Flare)2