Example usage for com.badlogic.gdx Preferences getString

List of usage examples for com.badlogic.gdx Preferences getString

Introduction

In this page you can find the example usage for com.badlogic.gdx Preferences getString.

Prototype

public String getString(String key, String defValue);

Source Link

Usage

From source file:com.a2client.Config.java

License:Open Source License

public static void Load() {
    Preferences p = getPrefs();
    WindowWidth = p.getInteger("window_width", 1024);
    WindowHeight = p.getInteger("window_height", 650);
    ScreenWidth = p.getInteger("screen_width", 1024);
    ScreenHeight = p.getInteger("screen_height", 768);
    FrameFate = p.getInteger("frame_rate", 60);
    vSync = p.getBoolean("use_vsync", true);
    ReduceInBackground = p.getBoolean("reduce_bg", true);
    //        SoundVolume = AppSettings.getInt("sound_vol", 50);
    //        MusicVolume = AppSettings.getInt("music_vol", 50);
    //        ScreenWidth_to_save = ScreenWidth;
    //        ScreenHeight_to_save = ScreenHeight;
    isFullscreen = p.getBoolean("start_fullscreen", false);
    //        SoundEnabled = AppSettings.getBool("sound_enabled", true);
    //        DebugEngine = AppSettings.getBool("debug_engine", false);
    current_lang = p.getString("language", "en");

    //        count_objs = AppSettings.getBool("count_objs", true);
    //        hide_overlapped = AppSettings.getBool("hide_overlapped", true);
    //        move_inst_left_mouse = AppSettings.getBool("move_inst_left_mouse", true);
    //        zoom_by_wheel = AppSettings.getBool("zoom_by_wheel", true);
    //        zoom_over_mouse = AppSettings.getBool("zoom_over_mouse", true);
    //        fullscreen_alt_enter = AppSettings.getBool("fullscreen_alt_enter", true);
    //        minimap_draw_objects = AppSettings.getBool("minimap_draw_objects", false);
    account = p.getString("account", "");
    password = p.getString("password", "");
    ////from w  ww .  ja va 2s .c o m
    save_pass = p.getBoolean("save_pass", false);
}

From source file:com.maplescot.loggerbill.misc.Profile.java

License:Creative Commons License

public void init(Preferences prefs) {
    ckSumV = prefs.getLong(CKSUMV, 0);/*from w  ww . j a  v  a 2  s.c  om*/
    soundOn = prefs.getBoolean(soundOnStr, true);
    musicOn = prefs.getBoolean(musicOnStr, true);
    totalPlays = prefs.getLong(totalPlaysStr, 0l);
    totalChunks = prefs.getLong(totalChunksStr, 0l);
    totalTime = prefs.getLong(totalTimeStr, 0l);
    bestChunks = prefs.getLong(bestChunksStr, 0l);
    bestCPS = prefs.getFloat(bestCPSStr, 0f);
    gplusId = prefs.getString(gplusStr, "");
    ckSum = prefs.getString(CKSUM, null);

    loadAchievements(prefs.getString(achievementsStr, ""));
    if (totalPlays == 0 && totalChunks == 0 && bestCPS == 0f && bestChunks == 0 && totalTime == 0) {
        ckSum = makeCkSum();
        ckSumV = ckVersion;
    }

    if (!isCkSumValid())
        reset();
}

From source file:com.vlaaad.dice.util.DicePreferences.java

License:Open Source License

public DicePreferences(Preferences preferences, App app) {
    this.preferences = preferences;
    this.app = app;
    volume = preferences.getFloat("volume", 0.5f);
    language = preferences.getString("language", Locale.getDefault().getLanguage());
    scale = preferences.getInteger("scale", (int) ScreenHelper.scaleFor(Gdx.graphics.getWidth(),
            Gdx.app.getType() == Application.ApplicationType.Desktop));
    rated = preferences.getBoolean("rated");
    music = preferences.getBoolean("music", true);
    servicesPaneShownByDefault = preferences.getBoolean("services-pane", false);
    applyVolume();//w  w w. jav a  2s.com
    applyMusic();
}

From source file:de.hasait.tanks.app.common.MainMenuScreen.java

License:Apache License

public MainMenuScreen(final TanksScreenContext pContext) {
    super(pContext, 800, 600);

    setBackgroundColor(new Color(0.0f, 0.0f, 0.2f, 1.0f));

    addInputProcessor(_inputProcessor);//w  ww . j a v  a 2s .  co m

    final Table layout = addLayout();
    layout.setFillParent(true);
    layout.defaults().pad(5.0f).align(Align.left).fill();

    final Label titleLabel = createLabel("Welcome to Tanks", 2.0f);
    layout.add(titleLabel).colspan(2).padBottom(20.0f);

    final Preferences preferences = obtainPreferences();

    layout.row();
    layout.add(createLabel("Room"));
    _roomNameField = createTextField(preferences.getString(PREFKEY__ROOM_NAME, "Default"));
    layout.add(_roomNameField);

    for (int i = 0; i < 2; i++) {
        layout.row();
        layout.add(createLabel("Player " + (i + 1)));
        final TextField playerNameField = createTextField();
        layout.add(playerNameField);
        _playerNameFields.add(playerNameField);
        PlayerConfig playerConfig = null;
        final String preferencesString = preferences.getString(PREFKEY__PLAYER_CONFIG + i);
        if (!Util.isEmpty(preferencesString)) {
            try {
                playerConfig = (PlayerConfig) Util.serializeFromString(preferencesString);
                Gdx.app.log("PlayerConfig", "Read for player " + i);
            } catch (final RuntimeException pE) {
                Gdx.app.error("PlayerConfig", "Cannot read for player " + i, pE);
            }
        }
        if (playerConfig == null) {
            Gdx.app.log("PlayerConfig", "New for player " + i);
            playerConfig = new PlayerConfig();
            if (i == 0) {
                playerConfig.setName("Player " + (i + 1));
                setActionSet1(playerConfig);
            } else if (i == 1) {
                setActionSet2(playerConfig);
            }
        }
        playerNameField.setText(playerConfig.getName());
        playerNameField.setUserObject(playerConfig);

        layout.add(actionConfig("Fire", playerConfig::getFire, playerConfig::setFire));
        layout.row();
        layout.add(createLabel(Util.EMPTY));
        layout.add(actionConfig("Move Forward", playerConfig::getMoveForward, playerConfig::setMoveForward));
        layout.add(actionConfig("Move Backward", playerConfig::getMoveBackward, playerConfig::setMoveBackward));
        layout.row();
        layout.add(createLabel(Util.EMPTY));
        layout.add(actionConfig("Rotate Left", playerConfig::getRotateLeft, playerConfig::setRotateLeft));
        layout.add(actionConfig("Rotate Right", playerConfig::getRotateRight, playerConfig::setRotateRight));
        layout.row();
        layout.add(createLabel(Util.EMPTY));
        layout.add(actionConfig("Turret Left", playerConfig::getTurrentRotateLeft,
                playerConfig::setTurrentRotateLeft));
        layout.add(actionConfig("Turret Right", playerConfig::getTurrentRotateRight,
                playerConfig::setTurrentRotateRight));
    }

    layout.row();
    _connectButton = createTextButton("Connect");
    layout.add(_connectButton).colspan(2);

    _connectButton.addListener(pEvent -> {
        if (pEvent instanceof ChangeListener.ChangeEvent) {
            _connect = true;
        }
        return false;
    });
}