Example usage for com.badlogic.gdx.utils SharedLibraryLoader isIos

List of usage examples for com.badlogic.gdx.utils SharedLibraryLoader isIos

Introduction

In this page you can find the example usage for com.badlogic.gdx.utils SharedLibraryLoader isIos.

Prototype

boolean isIos

To view the source code for com.badlogic.gdx.utils SharedLibraryLoader isIos.

Click Source Link

Usage

From source file:com.watabou.pixeldungeon.windows.WndGame.java

License:Open Source License

public WndGame() {

    super();//from ww w. j  a  va 2  s  .co m

    addButton(new RedButton(TXT_SETTINGS) {
        @Override
        protected void onClick() {
            hide();
            GameScene.show(new WndSettings(true));
        }
    });

    if (Dungeon.challenges > 0) {
        addButton(new RedButton(TXT_CHALLEGES) {
            @Override
            protected void onClick() {
                hide();
                GameScene.show(new WndChallenges(Dungeon.challenges, false));
            }
        });
    }

    if (!Dungeon.hero.isAlive()) {

        RedButton btnStart;
        addButton(btnStart = new RedButton(TXT_START) {
            @Override
            protected void onClick() {
                Dungeon.hero = null;
                PixelDungeon.challenges(Dungeon.challenges);
                InterlevelScene.mode = InterlevelScene.Mode.DESCEND;
                InterlevelScene.noStory = true;
                Game.switchScene(InterlevelScene.class);
            }
        });
        btnStart.icon(Icons.get(Dungeon.hero.heroClass));

        addButton(new RedButton(TXT_RANKINGS) {
            @Override
            protected void onClick() {
                InterlevelScene.mode = InterlevelScene.Mode.DESCEND;
                Game.switchScene(RankingsScene.class);
            }
        });
    }

    addButton(new RedButton(TXT_MENU) {
        @Override
        protected void onClick() {
            try {
                Dungeon.saveAll();
            } catch (IOException e) {
                //
            }
            Game.switchScene(TitleScene.class);
        }
    });

    addButton(new RedButton(TXT_EXIT) {
        @Override
        protected void onClick() {
            // On iOS the game doesn't get saved "automatically"
            // (GameScene.pause() is not called?) so we need to do it "manually"
            if (SharedLibraryLoader.isIos) {
                Game.scene().pause();
            }
            Game.instance.finish();
        }
    });

    addButton(new RedButton(TXT_RETURN) {
        @Override
        protected void onClick() {
            hide();
        }
    });

    resize(WIDTH, pos);
}