List of usage examples for com.badlogic.gdx Preferences getFloat
public float getFloat(String key, float defValue);
From source file:com.digitale.mygdxgame.Stardust3d.java
License:Open Source License
/** * /*from ww w . ja v a 2 s .c o m*/ */ private void loadPrefs() { // get prefs, if no prefs (-1) use factory setting Preferences prefs = Gdx.app.getPreferences("stardustpreferences"); float tempFloat; int tempInt = -1; boolean tempBoolean; tempBoolean = prefs.getBoolean("fontsize", false); tinyfont = tempBoolean; tempFloat = prefs.getFloat("sfxvolume", -1); if (tempFloat != -1) sfxVolume = tempFloat; // get music volume from prefs tempFloat = prefs.getFloat("musicvolume", -1); if (tempFloat != -1) musicVolume = tempFloat; // get chat channel from prefs tempInt = prefs.getInteger("selectedchatchannel", -1); if (tempInt != -1) { if (tempInt < -1) { tempInt = 8; } chatChannel = tempInt; } // get dust size from prefs tempFloat = prefs.getFloat("dustsize", 50); if (tempFloat != 50) dustsize = tempFloat; // get horiz dead zone from prefs tempFloat = prefs.getFloat("dzx", 0.5f); if (tempFloat != .5) deadzoneX = tempFloat; // get vert dead zone from prefs tempFloat = prefs.getFloat("dzy", 0.5f); if (tempFloat != .5) deadzoneY = tempFloat; // get horiz sensitivity from prefs tempFloat = prefs.getFloat("sx", 1f); if (tempFloat != 1) accelXsensitivity = tempFloat; // get very dead zone from prefs tempFloat = prefs.getFloat("sy", 1f); if (tempFloat != 1) accelYsensitivity = tempFloat; }
From source file:com.maplescot.loggerbill.misc.Profile.java
License:Creative Commons License
public void init(Preferences prefs) { ckSumV = prefs.getLong(CKSUMV, 0);/*from www .ja v a2 s .c o m*/ 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();/*from w w w .j av a 2s . co m*/ applyMusic(); }