Example usage for com.badlogic.gdx.backends.lwjgl LwjglPreferences LwjglPreferences

List of usage examples for com.badlogic.gdx.backends.lwjgl LwjglPreferences LwjglPreferences

Introduction

In this page you can find the example usage for com.badlogic.gdx.backends.lwjgl LwjglPreferences LwjglPreferences.

Prototype

public LwjglPreferences(String name, String directory) 

Source Link

Usage

From source file:com.a2client.Config.java

License:Open Source License

static protected Preferences getPrefs() {
    return new LwjglPreferences(CONFIG_FILE, ".prefs/");
}

From source file:com.vlaaad.dice.services.LocalGameServices.java

License:Open Source License

public LocalGameServices() {
    prefs = new LwjglPreferences("dice.local.game-services", ".prefs/");
    dispatcher.setState(ServicesState.valueOf(prefs.getString(KEY, ServicesState.DISCONNECTED.toString())));
}

From source file:de.fgerbig.spacepeng.desktop.DesktopLauncher.java

License:Apache License

public static void main(String[] args) {
    boolean forceWindowMode = false;

    // handle command line options
    if (args.length == 1) {
        forceWindowMode = args[0].equalsIgnoreCase("-window");
    }//from   ww w . j a  v  a 2 s  .com

    LwjglApplicationConfiguration config = new LwjglApplicationConfiguration();
    config.allowSoftwareMode = true;
    config.forceExit = true;

    // read full screen mode from preferences
    config.preferencesDirectory = PreferencesManager.PREFS_DIRNAME;
    LwjglPreferences preferences = new LwjglPreferences(PreferencesManager.PREFS_FILENAME,
            config.preferencesDirectory);
    config.fullscreen = preferences.getBoolean(PreferencesManager.PREF_FULLSCREEN_ENABLED);

    if (forceWindowMode) {
        System.out.println("Disabling full screen mode.");
        config.fullscreen = false;
        preferences.putBoolean(PreferencesManager.PREF_FULLSCREEN_ENABLED, false);
    }

    if (config.fullscreen) {
        System.out.println("Trying to set display mode to full screen.");
        System.out.println("(Start with command line option '-window') if this fails.)");

        // get desktop display mode
        Graphics.DisplayMode displayMode = LwjglApplicationConfiguration.getDesktopDisplayMode();

        // set screen size to desktop size
        config.width = displayMode.width;
        config.height = displayMode.height;

    } else {

        // set window size to default size
        config.width = Const.WIDTH;
        config.height = Const.HEIGHT;
    }

    new LwjglApplication(new SpacePeng(), config);
}

From source file:es.danirod.rectball.desktop.DesktopPlatform.java

License:Open Source License

protected DesktopPlatform() {
    sharing = new DesktopSharing();
    score = new LegacyScores() {
        @Override/* ww  w  .j av a  2s  . co  m*/
        protected FileHandle getScoresFile() {
            if (SharedLibraryLoader.isWindows) {
                String location = System.getenv("AppData") + "/rectball/scores";
                return Gdx.files.absolute(location);
            } else if (SharedLibraryLoader.isLinux) {
                return Gdx.files.external(".rectball/scores");
            } else if (SharedLibraryLoader.isMac) {
                return Gdx.files.external("/Library/Application Support/rectball/scores");
            } else {
                return Gdx.files.local("scores");
            }
        }
    };
    preferences = new LwjglPreferences("rectball", ".prefs/");
    statistics = new LegacyStatistics() {
        @Override
        protected FileHandle getStatistics() {
            if (SharedLibraryLoader.isWindows) {
                String location = System.getenv("AppData") + "/rectball/stats";
                return Gdx.files.absolute(location);
            } else if (SharedLibraryLoader.isLinux) {
                return Gdx.files.external(".rectball/stats");
            } else if (SharedLibraryLoader.isMac) {
                return Gdx.files.external("/Library/Application Support/rectball/stats");
            } else {
                return Gdx.files.local("stats");
            }
        }
    };
}