List of usage examples for com.badlogic.gdx Preferences getInteger
public int getInteger(String key, int defValue);
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", ""); //// w ww . j a va2s.c o m save_pass = p.getBoolean("save_pass", false); }
From source file:com.agateau.ui.GamepadInputMapper.java
License:Open Source License
@Override public void loadConfig(Preferences preferences, String prefix) { mButtonCodes.put(GamepadButton.TRIGGER, preferences.getInteger(prefix + TRIGGER_BUTTON_PREF, 1)); mButtonCodes.put(GamepadButton.BACK, preferences.getInteger(prefix + BACK_BUTTON_PREF, 2)); }
From source file:com.digitale.mygdxgame.Stardust3d.java
License:Open Source License
/** * //from w w w . ja v a 2 s .c om */ 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.gamestudio24.martianrun.utils.GameManager.java
License:Apache License
public void saveScore(int score) { Preferences preferences = getPreferences(); int maxScore = preferences.getInteger(MAX_SCORE_PREFERENCE, 0); if (score > maxScore) { preferences.putInteger(MAX_SCORE_PREFERENCE, score); preferences.flush();// w ww. j av a2 s .co m } }
From source file:com.gamestudio24.martianrun.utils.GameManager.java
License:Apache License
public void submitSavedMaxScore() { Preferences preferences = getPreferences(); submitScore(preferences.getInteger(MAX_SCORE_PREFERENCE, 0)); preferences.remove(MAX_SCORE_PREFERENCE); preferences.flush();//from w ww . j a va 2 s . co m }
From source file:com.gamestudio24.martianrun.utils.GameManager.java
License:Apache License
public void incrementAchievementCount(String id, int steps) { Preferences preferences = getPreferences(); int count = preferences.getInteger(getAchievementCountId(id), 0); count += steps;/* w ww . j a v a 2 s . c o m*/ preferences.putInteger(getAchievementCountId(id), count); preferences.flush(); }
From source file:com.jmstudios.pointandhit.UserPointer.java
License:Open Source License
public UserPointer(int radius, Vector2 screenSize, Preferences prefs) { rollSmoother = new ValueSmoother(); pitchSmoother = new ValueSmoother(); azimuthSmoother = new ValueSmoother(); this.radius = radius; this.screenSize = screenSize; float roll = Gdx.input.getRoll(); float pitch = Gdx.input.getPitch(); float azimuth = Gdx.input.getAzimuth(); this.startValue = mapToScreenAbsolute(roll, pitch, azimuth); this.screenSizeInDegrees = getScreenSizeInDegrees(prefs.getInteger("sensitivity", 2)); }
From source file:com.theosirian.ppioo.util.GameData.java
License:Open Source License
public GameData load() { Preferences state = Gdx.app.getPreferences(saveName); money = state.getInteger("money", money); victories = state.getInteger("victories", victories); defeats = state.getInteger("defeats", defeats); JsonValue json = new JsonReader().parse(Gdx.files.internal("data.json")); JsonValue playersJson = json.get("players"); for (JsonValue playerJson : playersJson.iterator()) { Player player = new Player(); player.setId(playerJson.getString("id")); player.setFirstName(playerJson.getString("first_name")); player.setLastName(playerJson.getString("last_name")); player.setAge(playerJson.getInt("age")); player.setCountry(playerJson.getString("country")); player.setPrice(playerJson.getInt("price")); player.setQuality(playerJson.getFloat("quality")); player.setConfidence(playerJson.getFloat("confidence")); player.setOwned(state.getBoolean(player.getId(), playerJson.getBoolean("owned", false))); String key = "player-" + player.getId(); player.setDateAcquired(new Date(state.getLong(key + "-date_acquired", new Date().getTime()))); player.setVictories(state.getInteger(key + "-victories", 0)); player.setDefeats(state.getInteger(key + "-defeats", 0)); players.add(player);/*from w ww . ja v a2s .c om*/ } JsonValue fansJson = json.get("fans"); for (JsonValue fanJson : fansJson.iterator()) { Fan fan = new Fan(); fan.setId(fanJson.getString("id")); fan.setName(fanJson.getString("name")); fan.setMinSupport(fanJson.getFloat("minSupport")); fan.setMaxSupport(fanJson.getFloat("maxSupport")); fan.setMinHuff(fanJson.getFloat("minHuff")); fan.setMaxHuff(fanJson.getFloat("maxHuff")); fan.setPrice(fanJson.getInt("price")); String key = "fan-" + fan.getId(); fan.setDateAcquired(new Date(state.getLong(key + "-date_acquired", new Date().getTime()))); fan.setVictories(state.getInteger(key + "-victories", 0)); fan.setDefeats(state.getInteger(key + "-defeats", 0)); fans.add(fan); } return this; }
From source file:com.tussle.logging.PreferenceLogFilter.java
License:Open Source License
public PreferenceLogFilter() { Preferences logPrefs = Utility.getPreferencesFor("log"); topLevel = logPrefs.getInteger("level", 1000); for (String entry : logPrefs.get().keySet()) { if (entry.endsWith("/level")) { try { Class<?> czz = Class.forName(entry.substring(0, entry.length() - 6)); systemLevels.put(czz, logPrefs.getInteger(entry)); } catch (ClassNotFoundException ex) { Logger.getLogger(this.getClass().toString()).warning( entry.substring(0, entry.length() - 6) + " is not a valid class name. Skipping. "); }/*from ww w. ja v a 2s. com*/ } } }
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.ja v a2s .c o m applyMusic(); }