Search in sources :

Example 11 with BitmapText

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

the class ItemSlot method createChildren.

@Override
protected void createChildren() {
    super.createChildren();
    icon = new ItemSprite();
    add(icon);
    emitter = new Emitter();
    add(emitter);
    topLeft = new BitmapText(PixelScene.font1x);
    topLeft.setScale(0.8f, 0.8f);
    add(topLeft);
    topRight = new BitmapText(PixelScene.font1x);
    topRight.setScale(0.8f, 0.8f);
    add(topRight);
    bottomRight = new BitmapText(PixelScene.font1x);
    bottomRight.setScale(0.8f, 0.8f);
    add(bottomRight);
}
Also used : Emitter(com.watabou.noosa.particles.Emitter) BitmapText(com.watabou.noosa.BitmapText) ItemSprite(com.watabou.pixeldungeon.sprites.ItemSprite)

Example 12 with BitmapText

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

the class StatusPane method createChildren.

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

        @Override
        protected void onClick(Touch touch) {
            Image sprite = hero.getSprite();
            if (!sprite.isVisible()) {
                Camera.main.focusOn(sprite);
            }
            GameScene.show(new WndHero());
        }
    });
    avatar = hero.getHeroSprite().avatar();
    add(avatar);
    blood = new Emitter();
    blood.pos(avatar);
    blood.pour(BloodParticle.FACTORY, 0.3f);
    blood.autoKill = false;
    blood.on = false;
    add(blood);
    int compassTarget = currentLevel.entrance;
    if (currentLevel.hasCompassTarget()) {
        // Set to compass target if exists
        compassTarget = currentLevel.getCompassTarget();
    } else if (currentLevel.hasExit(0)) {
        // Set to first exit if exists
        compassTarget = currentLevel.getExit(0);
    }
    compass = new Compass(compassTarget, currentLevel);
    add(compass);
    hp = new Image(Assets.HP_BAR);
    add(hp);
    sp = new Image(Assets.SP_BAR);
    add(sp);
    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);
    hero.belongings.countIronKeys();
    keys = new BitmapText(PixelScene.font1x);
    keys.hardlight(0xCACFC2);
    add(keys);
    danger = new DangerIndicator();
    add(danger);
    loot = new LootIndicator();
    add(loot);
    buffs = new BuffIndicator(hero);
    add(buffs);
    btnMenu = new MenuButton(new Image(Assets.getStatus(), 114, 3, 12, 11), WndGame.class);
    add(btnMenu);
    btnHats = new MenuButton(new Image(Assets.getStatus(), 114, 18, 12, 11), WndHats.class);
    btnSpells = new MenuButton(new Image(Assets.getStatus(), 2, 33, 12, 11), WndHeroSpells.class);
    if (!Flavours.haveHats()) {
        btnHats.enable(false);
    }
    if (!hero.spellUser) {
        btnSpells.enable(false);
    }
    add(btnSpells);
    add(btnHats);
}
Also used : Emitter(com.watabou.noosa.particles.Emitter) NinePatch(com.watabou.noosa.NinePatch) WndGame(com.watabou.pixeldungeon.windows.WndGame) Touch(com.watabou.input.Touchscreen.Touch) Image(com.watabou.noosa.Image) CompositeTextureImage(com.watabou.noosa.CompositeTextureImage) WndHero(com.watabou.pixeldungeon.windows.WndHero) WndHats(com.watabou.pixeldungeon.windows.WndHats) TouchArea(com.watabou.noosa.TouchArea) BitmapText(com.watabou.noosa.BitmapText) WndHeroSpells(com.nyrds.pixeldungeon.windows.WndHeroSpells)

Example 13 with BitmapText

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

the class RankingsScene method create.

@Override
public void create() {
    super.create();
    Music.INSTANCE.play(Assets.THEME, true);
    Music.INSTANCE.volume(1f);
    uiCamera.visible = false;
    int w = Camera.main.width;
    int h = Camera.main.height;
    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 left = (w - Math.min(MAX_ROW_WIDTH, w)) / 2 + GAP;
        float top = align((h - rowHeight * Rankings.INSTANCE.records.size()) / 2);
        BitmapText title = PixelScene.createText(TXT_TITLE, 9);
        title.hardlight(Window.TITLE_COLOR);
        title.measure();
        title.x = align((w - title.width()) / 2);
        title.y = align(top - title.height() - GAP);
        add(title);
        int pos = 0;
        for (Rankings.Record rec : Rankings.INSTANCE.records) {
            Record row = new Record(pos, pos == Rankings.INSTANCE.lastRecord, rec);
            row.setRect(left, top + pos * rowHeight, w - left * 2, rowHeight);
            add(row);
            pos++;
        }
        if (Rankings.INSTANCE.totalNumber >= Rankings.TABLE_SIZE) {
            BitmapText label = PixelScene.createText(TXT_TOTAL, 8);
            label.hardlight(DEFAULT_COLOR);
            label.measure();
            add(label);
            BitmapText won = PixelScene.createText(Integer.toString(Rankings.INSTANCE.wonNumber), 8);
            won.hardlight(Window.TITLE_COLOR);
            won.measure();
            add(won);
            BitmapText total = PixelScene.createText("/" + Rankings.INSTANCE.totalNumber, 8);
            total.hardlight(DEFAULT_COLOR);
            total.measure();
            total.x = align((w - total.width()) / 2);
            total.y = align(top + pos * rowHeight + GAP);
            add(total);
            float tw = label.width() + won.width() + total.width();
            label.x = align((w - tw) / 2);
            won.x = label.x + label.width();
            total.x = won.x + won.width();
            label.y = won.y = total.y = align(top + pos * rowHeight + GAP);
        }
    } else {
        BitmapText title = PixelScene.createText(TXT_NO_GAMES, 8);
        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) BitmapText(com.watabou.noosa.BitmapText) ExitButton(com.watabou.pixeldungeon.ui.ExitButton) Rankings(com.watabou.pixeldungeon.Rankings)

Example 14 with BitmapText

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

the class TitleScene method create.

@Override
public void create() {
    super.create();
    Music.INSTANCE.play(Assets.THEME, true);
    Music.INSTANCE.volume(1f);
    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 height = title.height + (PixelDungeon.landscape() ? DashboardItem.SIZE : DashboardItem.SIZE * 2);
    title.x = (w - title.width()) / 2;
    title.y = (h - height) / 2;
    placeTorch(title.x + 18, title.y + 20);
    placeTorch(title.x + title.width - 18, title.y + 20);
    Image signs = new Image(BannerSprites.get(BannerSprites.Type.PIXEL_DUNGEON_SIGNS)) {

        private float time = 0;

        @Override
        public void update() {
            super.update();
            am = (float) Math.sin(-(time += Game.elapsed));
        }

        @Override
        public void draw() {
            GLES20.glBlendFunc(GL10.GL_SRC_ALPHA, GL10.GL_ONE);
            super.draw();
            GLES20.glBlendFunc(GL10.GL_SRC_ALPHA, GL10.GL_ONE_MINUS_SRC_ALPHA);
        }
    };
    signs.x = title.x;
    signs.y = title.y;
    add(signs);
    DashboardItem btnBadges = new DashboardItem(TXT_BADGES, 3) {

        @Override
        protected void onClick() {
            PixelDungeon.switchNoFade(BadgesScene.class);
        }
    };
    add(btnBadges);
    DashboardItem btnAbout = new DashboardItem(TXT_ABOUT, 1) {

        @Override
        protected void onClick() {
            PixelDungeon.switchNoFade(AboutScene.class);
        }
    };
    add(btnAbout);
    DashboardItem btnPlay = new DashboardItem(TXT_PLAY, 0) {

        @Override
        protected void onClick() {
            PixelDungeon.switchNoFade(StartScene.class);
        }
    };
    add(btnPlay);
    DashboardItem btnHighscores = new DashboardItem(TXT_HIGHSCORES, 2) {

        @Override
        protected void onClick() {
            PixelDungeon.switchNoFade(RankingsScene.class);
        }
    };
    add(btnHighscores);
    if (PixelDungeon.landscape()) {
        float y = (h + height) / 2 - DashboardItem.SIZE;
        btnHighscores.setPos(w / 2 - btnHighscores.width(), y);
        btnBadges.setPos(w / 2, y);
        btnPlay.setPos(btnHighscores.left() - btnPlay.width(), y);
        btnAbout.setPos(btnBadges.right(), y);
    } else {
        btnBadges.setPos(w / 2 - btnBadges.width(), (h + height) / 2 - DashboardItem.SIZE);
        btnAbout.setPos(w / 2, (h + height) / 2 - DashboardItem.SIZE);
        btnPlay.setPos(w / 2 - btnPlay.width(), btnAbout.top() - DashboardItem.SIZE);
        btnHighscores.setPos(w / 2, btnPlay.top());
    }
    BitmapText version = new BitmapText("v " + Game.version, font1x);
    version.measure();
    version.hardlight(0x888888);
    version.x = w - version.width();
    version.y = h - version.height();
    add(version);
    PrefsButton btnPrefs = new PrefsButton();
    btnPrefs.setPos(0, 0);
    add(btnPrefs);
    ExitButton btnExit = new ExitButton();
    btnExit.setPos(w - btnExit.width(), 0);
    add(btnExit);
    fadeIn();
}
Also used : Archs(com.watabou.pixeldungeon.ui.Archs) BitmapText(com.watabou.noosa.BitmapText) ExitButton(com.watabou.pixeldungeon.ui.ExitButton) PrefsButton(com.watabou.pixeldungeon.ui.PrefsButton) Image(com.watabou.noosa.Image)

Example 15 with BitmapText

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

the class GoldIndicator method createChildren.

@Override
protected void createChildren() {
    tf = new BitmapText(PixelScene.font1x);
    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