List of usage examples for com.badlogic.gdx Preferences getBoolean
public boolean getBoolean(String key, boolean 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", ""); ///*from www . j a v a 2s . c o m*/ save_pass = p.getBoolean("save_pass", false); }
From source file:com.digitale.mygdxgame.Stardust3d.java
License:Open Source License
/** * //from ww w . j av 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);// w w w .j av a2 s .co 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.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);/* w ww .j av a2 s . c o m*/ } 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:eu.rubenrosado.inmisericordia.LSGame.java
License:Open Source License
/** * /*from w ww . j a va2s . c om*/ * @return if exists any saved game */ public boolean existsSavedGame() { Preferences pref = Gdx.app.getPreferences(".sav"); if (!pref.getBoolean("savedgame", false)) { return false; } return true; }
From source file:eu.rubenrosado.inmisericordia.LSGame.java
License:Open Source License
/** * Save the game in JSon/* w w w. j ava 2 s . c om*/ */ public void saveGame() { Json json = new Json(); String hero = json.toJson(PlayGame.hero, Hero.class); String monsters = json.toJson(PlayGame.monsters, Monster.class); FileHandle file = Gdx.files.local("hero.sav"); file.writeString(hero, false); file = Gdx.files.local("monsters.sav"); file.writeString(monsters, false); Preferences pref = Gdx.app.getPreferences(".sav"); if (!pref.getBoolean("savedgame", false)) { pref.putBoolean("savedgame", true); } pref.flush(); }
From source file:headmade.arttag.screens.IntroScreen.java
License:Apache License
@Override public void preDraw(float delta) { super.preDraw(delta); if (!isInitialised) { Gdx.app.log(TAG, "Loading Prefs"); isInitialised = true;//from www.ja v a 2 s . co m ArtTag.gameSettings = new GameSettings(); final Preferences prefs = Gdx.app.getPreferences("ArtTreacheryPrefs"); ArtTag.gameSettings.screenWidth = prefs.getInteger("screenWidth", 1280); ArtTag.gameSettings.screenHeight = prefs.getInteger("screenHeight", 1024); ArtTag.gameSettings.fullscreen = prefs.getBoolean("fullscreen", false); ArtTag.gameSettings.blur = prefs.getInteger("blur", 1); ArtTag.gameSettings.rays = prefs.getInteger("rays", 64); ArtTag.gameSettings.handleResAuto = prefs.getBoolean("handleResAuto", true); Gdx.app.log(TAG, "Saving Prefs"); prefs.putInteger("screenWidth", ArtTag.gameSettings.screenWidth); prefs.putInteger("screenHeight", ArtTag.gameSettings.screenHeight); prefs.putBoolean("fullscreen", ArtTag.gameSettings.fullscreen); prefs.putInteger("blur", ArtTag.gameSettings.blur); prefs.putInteger("rays", ArtTag.gameSettings.rays); prefs.putBoolean("handleResAuto", ArtTag.gameSettings.handleResAuto); prefs.flush(); if (Gdx.graphics.supportsDisplayModeChange() && ArtTag.gameSettings.handleResAuto == false) { Gdx.app.log(TAG, "Trying to set Displaymode"); Gdx.graphics.setDisplayMode(ArtTag.gameSettings.screenWidth, ArtTag.gameSettings.screenHeight, ArtTag.gameSettings.fullscreen); // Gdx.gl.glViewport(0, 0, ArtTag.gameSettings.screenWidth, ArtTag.gameSettings.screenHeight); } } Assets.assetsManager.update(); if (!isStarted && MathUtils.isEqual(1f, Assets.assetsManager.getProgress())) { // done loading eh Assets.instance.onFinishLoading(); startGame(); isStarted = true; // final TextButton startButton = new TextButton("Start", Assets.instance.skin); // startButton.addListener(new InputListener() { // // @Override // public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) { // startGame(); // return super.touchDown(event, x, y, pointer, button); // } // }); } }
From source file:io.piotrjastrzebski.dungen.DungenScreen.java
License:Apache License
public DungenScreen(DungenGame game) { super();/*from w ww. ja v a2 s . c om*/ this.game = game; genSettings = new GenSettings().setGridSize(.25f).setCount(150).setSpawnWidth(20).setSpawnHeight(10) .setRoomWidth(4).setRoomHeight(4).setMainRoomScale(1.15f).setReconnectChance(.2f) .setHallwaysWidth(2).setB2bIters(100); drawSettings = new DrawSettings().setDrawExtra(true).setDrawMain(true).setDrawHallWays(true) .setDrawUnused(true); generator = new DungeonGenerator(); generator.init(genSettings); grid = new Grid(); grid.setSize(genSettings.getGridSize()); genGui = new GenSettingsGUI(this, this); genGui.setDefaults(genSettings); stage.addActor(genGui); genGui.setPosition(10, 10); drawGui = new DrawSettingsGUI(this); drawGui.setDefaults(drawSettings); stage.addActor(drawGui); drawGui.setPosition(10, stage.getHeight() - drawGui.getHeight() - 10); multiplexer.addProcessor(this); multiplexer.addProcessor(new GestureDetector(this)); helpGUI = new HelpGUI(); VisTable helpCont = new VisTable(); helpCont.setFillParent(true); VisTextButton showHelp = new VisTextButton("Help!"); showHelp.addListener(new ClickListener() { @Override public void clicked(InputEvent event, float x, float y) { helpGUI.show(stage); } }); helpCont.add(showHelp).right().top().expand().pad(10); stage.addActor(helpCont); Preferences dungen = Gdx.app.getPreferences("Dungen"); if (!dungen.getBoolean("help-shown", false)) { helpGUI.show(stage); dungen.putBoolean("help-shown", true); dungen.flush(); } }