Search in sources :

Example 46 with Image

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

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

the class HeroSprite method avatar.

public static Image avatar(HeroClass cl, int armorTier) {
    RectF patch = tiers().get(armorTier);
    Image avatar = new Image(cl.spritesheet());
    RectF frame = avatar.texture.uvRect(1, 0, FRAME_WIDTH, FRAME_HEIGHT);
    frame.shift(patch.left, patch.top);
    avatar.frame(frame);
    return avatar;
}
Also used : RectF(com.watabou.utils.RectF) Image(com.watabou.noosa.Image)

Example 48 with Image

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

the class Combo method getIcon.

@Override
public Image getIcon() {
    Image icon;
    if (((Hero) target).belongings.weapon != null) {
        icon = new ItemSprite(((Hero) target).belongings.weapon.image, null);
    } else {
        icon = new ItemSprite(new Item() {

            {
                image = ItemSpriteSheet.WEAPON_HOLDER;
            }
        });
    }
    if (count >= 10)
        icon.tint(0xFFFF0000);
    else if (count >= 8)
        icon.tint(0xFFFFCC00);
    else if (count >= 6)
        icon.tint(0xFFFFFF00);
    else if (count >= 4)
        icon.tint(0xFFCCFF00);
    else
        icon.tint(0xFF00FF00);
    return icon;
}
Also used : Item(com.shatteredpixel.shatteredpixeldungeon.items.Item) Hero(com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero) ItemSprite(com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSprite) Image(com.watabou.noosa.Image)

Example 49 with Image

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

the class Preparation method getIcon.

@Override
public Image getIcon() {
    Image actionIco = Effects.get(Effects.Type.WOUND);
    tintIcon(actionIco);
    return actionIco;
}
Also used : Image(com.watabou.noosa.Image)

Example 50 with Image

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

the class TerrainFeaturesTilemap method growPlant.

public void growPlant(final int pos) {
    final Image plant = tile(pos, map[pos]);
    if (plant == null)
        return;
    plant.origin.set(8, 12);
    plant.scale.set(0);
    plant.point(DungeonTilemap.tileToWorld(pos));
    parent.add(plant);
    parent.add(new ScaleTweener(plant, new PointF(1, 1), 0.2f) {

        protected void onComplete() {
            plant.killAndErase();
            killAndErase();
            updateMapCell(pos);
        }
    });
}
Also used : ScaleTweener(com.watabou.noosa.tweeners.ScaleTweener) PointF(com.watabou.utils.PointF) 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