Search in sources :

Example 16 with BitmapText

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

the class StatusPane method createChildren.

@Override
protected void createChildren() {
    shield = new NinePatch(Assets.STATUS, 80, 0, 30 + 18, 0);
    add(shield);
    add(new TouchArea(0, 1, 30, 30) {

        @Override
        protected void onClick(Touch touch) {
            Image sprite = Dungeon.hero.sprite;
            if (!sprite.isVisible()) {
                Camera.main.focusOn(sprite);
            }
            GameScene.show(new WndHero());
        }
    });
    btnMenu = new MenuButton();
    add(btnMenu);
    avatar = HeroSprite.avatar(Dungeon.hero.heroClass, lastTier);
    add(avatar);
    blood = new BitmaskEmitter(avatar);
    blood.pour(BloodParticle.FACTORY, 0.3f);
    blood.autoKill = false;
    blood.on = false;
    add(blood);
    compass = new Compass(Dungeon.level.exit);
    add(compass);
    hp = new Image(Assets.HP_BAR);
    add(hp);
    exp = new Image(Assets.XP_BAR);
    add(exp);
    level = new BitmapText(PixelScene.font1x);
    level.hardlight(0xFFEBA4);
    add(level);
    depth = new BitmapText(Integer.toString(Dungeon.depth), PixelScene.font1x);
    depth.hardlight(0xCACFC2);
    depth.measure();
    add(depth);
    Dungeon.hero.belongings.countIronKeys();
    keys = new BitmapText(PixelScene.font1x);
    keys.hardlight(0xCACFC2);
    add(keys);
    danger = new DangerIndicator();
    add(danger);
    loot = new LootIndicator();
    add(loot);
    resume = new ResumeButton();
    add(resume);
    buffs = new BuffIndicator(Dungeon.hero);
    add(buffs);
}
Also used : NinePatch(com.watabou.noosa.NinePatch) Touch(com.watabou.input.Touchscreen.Touch) Image(com.watabou.noosa.Image) WndHero(com.watabou.pixeldungeon.windows.WndHero) BitmaskEmitter(com.watabou.noosa.particles.BitmaskEmitter) TouchArea(com.watabou.noosa.TouchArea) BitmapText(com.watabou.noosa.BitmapText)

Example 17 with BitmapText

use of com.watabou.noosa.BitmapText in project shattered-pixel-dungeon-gdx by 00-Evan.

the class PixelScene method createText.

public static BitmapText createText(String text, float size) {
    chooseFont(size);
    BitmapText result = new BitmapText(text, font);
    result.scale.set(scale);
    return result;
}
Also used : BitmapText(com.watabou.noosa.BitmapText)

Example 18 with BitmapText

use of com.watabou.noosa.BitmapText in project shattered-pixel-dungeon-gdx by 00-Evan.

the class TitleScene method create.

@Override
public void create() {
    super.create();
    Music.INSTANCE.play(Assets.THEME, true);
    uiCamera.visible = false;
    int w = Camera.main.width;
    int h = Camera.main.height;
    Archs archs = new Archs();
    archs.setSize(w, h);
    add(archs);
    Image title = BannerSprites.get(BannerSprites.Type.PIXEL_DUNGEON);
    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);
    placeTorch(title.x + 22, title.y + 46);
    placeTorch(title.x + title.width - 22, title.y + 46);
    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);
    DashboardItem btnBadges = new DashboardItem(Messages.get(this, "badges"), 3) {

        @Override
        protected void onClick() {
            ShatteredPixelDungeon.switchNoFade(BadgesScene.class);
        }
    };
    add(btnBadges);
    DashboardItem btnAbout = new DashboardItem(Messages.get(this, "about"), 1) {

        @Override
        protected void onClick() {
            ShatteredPixelDungeon.switchNoFade(AboutScene.class);
        }
    };
    add(btnAbout);
    DashboardItem btnPlay = new DashboardItem(Messages.get(this, "play"), 0) {

        @Override
        protected void onClick() {
            if (GamesInProgress.checkAll().size() == 0) {
                TitleScene.this.add(new WndStartGame(1));
            } else {
                ShatteredPixelDungeon.switchNoFade(StartScene.class);
            }
        }
    };
    add(btnPlay);
    DashboardItem btnRankings = new DashboardItem(Messages.get(this, "rankings"), 2) {

        @Override
        protected void onClick() {
            ShatteredPixelDungeon.switchNoFade(RankingsScene.class);
        }
    };
    add(btnRankings);
    if (SPDSettings.landscape()) {
        btnRankings.setPos(w / 2 - btnRankings.width(), topRegion);
        btnBadges.setPos(w / 2, topRegion);
        btnPlay.setPos(btnRankings.left() - btnPlay.width(), topRegion);
        btnAbout.setPos(btnBadges.right(), topRegion);
    } else {
        btnPlay.setPos(w / 2 - btnPlay.width(), topRegion);
        btnRankings.setPos(w / 2, btnPlay.top());
        btnBadges.setPos(w / 2 - btnBadges.width(), btnPlay.top() + DashboardItem.SIZE);
        btnAbout.setPos(w / 2, btnBadges.top());
    }
    BitmapText version = new BitmapText("v " + Game.version + "", pixelFont);
    version.measure();
    version.hardlight(0xCCCCCC);
    version.x = w - version.width();
    version.y = h - version.height();
    add(version);
    Button changes = new ChangesButton();
    changes.setPos(w - changes.width(), h - version.height() - changes.height());
    add(changes);
    int pos = 0;
    PrefsButton btnPrefs = new PrefsButton();
    btnPrefs.setRect(pos, 0, 16, 16);
    add(btnPrefs);
    pos += btnPrefs.width();
    LanguageButton btnLang = new LanguageButton();
    btnLang.setRect(pos, 0, 14, 16);
    add(btnLang);
    ExitButton btnExit = new ExitButton();
    btnExit.setPos(w - btnExit.width(), 0);
    add(btnExit);
    UpdateNotification updInfo = new UpdateNotification();
    updInfo.setPos(0, h - updInfo.height());
    add(updInfo);
    fadeIn();
}
Also used : LanguageButton(com.shatteredpixel.shatteredpixeldungeon.ui.LanguageButton) UpdateNotification(com.shatteredpixel.shatteredpixeldungeon.ui.UpdateNotification) ExitButton(com.shatteredpixel.shatteredpixeldungeon.ui.ExitButton) ChangesButton(com.shatteredpixel.shatteredpixeldungeon.ui.ChangesButton) Image(com.watabou.noosa.Image) WndStartGame(com.shatteredpixel.shatteredpixeldungeon.windows.WndStartGame) Archs(com.shatteredpixel.shatteredpixeldungeon.ui.Archs) BitmapText(com.watabou.noosa.BitmapText) PrefsButton(com.shatteredpixel.shatteredpixeldungeon.ui.PrefsButton) ExitButton(com.shatteredpixel.shatteredpixeldungeon.ui.ExitButton) ChangesButton(com.shatteredpixel.shatteredpixeldungeon.ui.ChangesButton) LanguageButton(com.shatteredpixel.shatteredpixeldungeon.ui.LanguageButton) Button(com.watabou.noosa.ui.Button) PrefsButton(com.shatteredpixel.shatteredpixeldungeon.ui.PrefsButton)

Example 19 with BitmapText

use of com.watabou.noosa.BitmapText in project shattered-pixel-dungeon-gdx by 00-Evan.

the class DangerIndicator method createChildren.

@Override
protected void createChildren() {
    super.createChildren();
    number = new BitmapText(PixelScene.pixelFont);
    add(number);
    icon = Icons.SKULL.get();
    add(icon);
}
Also used : BitmapText(com.watabou.noosa.BitmapText)

Example 20 with BitmapText

use of com.watabou.noosa.BitmapText in project shattered-pixel-dungeon-gdx by 00-Evan.

the class GoldIndicator method createChildren.

@Override
protected void createChildren() {
    tf = new BitmapText(PixelScene.pixelFont);
    tf.hardlight(0xFFFF00);
    add(tf);
    visible = false;
}
Also used : BitmapText(com.watabou.noosa.BitmapText)

Aggregations

BitmapText (com.watabou.noosa.BitmapText)20 Image (com.watabou.noosa.Image)6 Archs (com.watabou.pixeldungeon.ui.Archs)4 ExitButton (com.watabou.pixeldungeon.ui.ExitButton)4 NinePatch (com.watabou.noosa.NinePatch)3 ItemSprite (com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSprite)2 Touch (com.watabou.input.Touchscreen.Touch)2 TouchArea (com.watabou.noosa.TouchArea)2 Emitter (com.watabou.noosa.particles.Emitter)2 ItemSprite (com.watabou.pixeldungeon.sprites.ItemSprite)2 WndHero (com.watabou.pixeldungeon.windows.WndHero)2 Callback (com.watabou.utils.Callback)2 WndHeroSpells (com.nyrds.pixeldungeon.windows.WndHeroSpells)1 GameAction (com.shatteredpixel.shatteredpixeldungeon.input.GameAction)1 Archs (com.shatteredpixel.shatteredpixeldungeon.ui.Archs)1 ChangesButton (com.shatteredpixel.shatteredpixeldungeon.ui.ChangesButton)1 ExitButton (com.shatteredpixel.shatteredpixeldungeon.ui.ExitButton)1 LanguageButton (com.shatteredpixel.shatteredpixeldungeon.ui.LanguageButton)1 PrefsButton (com.shatteredpixel.shatteredpixeldungeon.ui.PrefsButton)1 UpdateNotification (com.shatteredpixel.shatteredpixeldungeon.ui.UpdateNotification)1