public Settings() { prefs = Gdx.app.getPreferences("appsettings"); scanLineShaderEnabled = prefs.getBoolean("scanLineShaderEnabled", false); audioEnabled = prefs.getBoolean("audioEnabled", false); dynamicLightingEnabled = prefs.getBoolean("dynamicLightingEnabled", false); }
@Override public void preDraw(float delta) { super.preDraw(delta); if (!isInitialised) { Gdx.app.log(TAG, "Loading Prefs"); isInitialised = true; 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); // } // }); } }
public void load() { sound = prefs.getBoolean("sound", true); music = prefs.getBoolean("music", true); // если нет записи в "volSound" берем значение 0.5 и проверяем на границы от 0.0 до 1.0 volSound = MathUtils.clamp(prefs.getFloat("volSound", 0.5f), 0.0f, 1.0f); volMusic = MathUtils.clamp(prefs.getFloat("volMusic", 0.5f), 0.0f, 1.0f); charSkin = MathUtils.clamp(prefs.getInteger("charSkin", 0), 0, 2); showFpsCounter = prefs.getBoolean("showFpsCounter", false); useMonochromeShader = prefs.getBoolean("useMonochromeShader", false); }
private void initMusic() { music = AssetsLoader.getMusic(); boolean musicOn = preferences.getBoolean("musicOn", true); float musicVolume = preferences.getFloat("musicVolume", 1); music.setLooping(true); if (musicOn) { music.play(); } music.setVolume(musicVolume); }
private Settings() { loadTables(); // NOTES: on desktop, file is store in /Users/[username]/.prefs/[name] Preferences p = Gdx.app.getPreferences(PREFS_NAME); if (p.contains("soundOn")) { this.soundOn = p.getBoolean("soundOn"); } if (p.contains("musicOn")) { this.musicOn = p.getBoolean("musicOn"); } if (p.contains("rulesEverSeen")) { this.rulesEverSeen = p.getBoolean("rulesEverSeen"); } // look for best scores on all of the tables // best score is stored as a key matching the map file for (TableInfo ti : this.tables) { if (p.contains(ti.getName())) { ti.setHighScore(p.getInteger(ti.getName())); } } }
public boolean showPing() { boolean getPing = preferences.getBoolean("showPing", true); return getPing; }
public boolean showFPS() { boolean getFps = preferences.getBoolean("showFPS", false); return getFps; }
public static void load(NanoCat nano) { pref = Gdx.app.getPreferences("NanoGameState"); if (!pref.getBoolean("hdState")) { if (nano.getTime() < 15 && nano.getTime() >= 5) { bgTexture = new Texture(Gdx.files.internal("data/bg_1_s.png")); bgTexture.setFilter(TextureFilter.Linear, TextureFilter.Linear); bgBackTexture = new Texture(Gdx.files.internal("data/bg_dist_1_s.png")); bgBackTexture.setFilter(TextureFilter.Linear, TextureFilter.Linear); } else if (nano.getTime() < 20 && nano.getTime() >= 15) { bgTexture = new Texture(Gdx.files.internal("data/bg_2_s.png")); bgTexture.setFilter(TextureFilter.Linear, TextureFilter.Linear); bgBackTexture = new Texture(Gdx.files.internal("data/bg_dist_2_s.png")); bgBackTexture.setFilter(TextureFilter.Linear, TextureFilter.Linear); } else if (nano.getTime() >= 20) { bgTexture = new Texture(Gdx.files.internal("data/bg_3_s.png")); bgTexture.setFilter(TextureFilter.Linear, TextureFilter.Linear); bgBackTexture = new Texture(Gdx.files.internal("data/bg_dist_3_s.png")); bgBackTexture.setFilter(TextureFilter.Linear, TextureFilter.Linear); } else { bgTexture = new Texture(Gdx.files.internal("data/bg_3_s.png")); bgTexture.setFilter(TextureFilter.Linear, TextureFilter.Linear); bgBackTexture = new Texture(Gdx.files.internal("data/bg_dist_3_s.png")); bgBackTexture.setFilter(TextureFilter.Linear, TextureFilter.Linear); } } else if (pref.getBoolean("hdState")) { if (nano.getTime() < 15 && nano.getTime() >= 5) { bgTexture = new Texture(Gdx.files.internal("data/bg_1.png")); bgTexture.setFilter(TextureFilter.Linear, TextureFilter.Linear); bgBackTexture = new Texture(Gdx.files.internal("data/bg_dist_1.png")); bgBackTexture.setFilter(TextureFilter.Linear, TextureFilter.Linear); } else if (nano.getTime() < 20 && nano.getTime() >= 15) { bgTexture = new Texture(Gdx.files.internal("data/bg_2.png")); bgTexture.setFilter(TextureFilter.Linear, TextureFilter.Linear); bgBackTexture = new Texture(Gdx.files.internal("data/bg_dist_2.png")); bgBackTexture.setFilter(TextureFilter.Linear, TextureFilter.Linear); } else if (nano.getTime() >= 20) { bgTexture = new Texture(Gdx.files.internal("data/bg_3.png")); bgTexture.setFilter(TextureFilter.Linear, TextureFilter.Linear); bgBackTexture = new Texture(Gdx.files.internal("data/bg_dist_3.png")); bgBackTexture.setFilter(TextureFilter.Linear, TextureFilter.Linear); } else { bgTexture = new Texture(Gdx.files.internal("data/bg_3.png")); bgTexture.setFilter(TextureFilter.Linear, TextureFilter.Linear); bgBackTexture = new Texture(Gdx.files.internal("data/bg_dist_3.png")); bgBackTexture.setFilter(TextureFilter.Linear, TextureFilter.Linear); } } bgBack = new TextureRegion(bgBackTexture, 0, 0, 4096, 580); // Particle Stuff smoke = new Texture(Gdx.files.internal("data/smoke_particle.png")); smokeSprite = new Sprite(smoke); smokeEmitter = new ParticleEmitter(); smokeParticle = new ParticleEffect(); smokeParticle.load(Gdx.files.internal("data/particlesmoke"), Gdx.files.internal("data")); smokeParticle.findEmitter("smoke").getScale().setHigh(50f); starEmitter = new ParticleEmitter(); starParticle = new ParticleEffect(); starParticle.load(Gdx.files.internal("data/particles"), Gdx.files.internal("data")); starParticle.findEmitter("star").getScale().setHigh(5f); starParticle.findEmitter("star2").getScale().setHigh(5f); // smokeParticle.getScale().setHigh(5f); // End Particle Stuff texture = new Texture(Gdx.files.internal("data/nano_region.png")); texture.setFilter(TextureFilter.Nearest, TextureFilter.Nearest); nanoRun = new TextureAtlas(Gdx.files.internal("data/nanorun.atlas")); platform = new TextureAtlas(Gdx.files.internal("data/platform.atlas")); catRun1 = nanoRun.findRegion("nanorun0001"); catRun2 = nanoRun.findRegion("nanorun0005"); catRun3 = nanoRun.findRegion("nanorun0009"); catRun4 = nanoRun.findRegion("nanorun0013"); catRun5 = nanoRun.findRegion("nanorun0017"); catRun6 = nanoRun.findRegion("nanorun0021"); catRun7 = nanoRun.findRegion("nanorun0025"); catRun8 = nanoRun.findRegion("nanorun0029"); catRun9 = nanoRun.findRegion("nanorun0033"); catRun10 = nanoRun.findRegion("nanorun0037"); catRun11 = nanoRun.findRegion("nanorun0041"); catRun12 = nanoRun.findRegion("nanorun0045"); catRun13 = nanoRun.findRegion("nanorun0049"); catRun14 = nanoRun.findRegion("nanorun0053"); catRun15 = nanoRun.findRegion("nanorun0057"); catCollide1 = nanoRun.findRegion("nanocollide0080"); catCollide2 = nanoRun.findRegion("nanocollide0084"); catCollide3 = nanoRun.findRegion("nanocollide0088"); catCollide4 = nanoRun.findRegion("nanocollide0092"); catCollide5 = nanoRun.findRegion("nanocollide0096"); catCollide6 = nanoRun.findRegion("nanocollide0100"); catCollide7 = nanoRun.findRegion("nanocollide0104"); catCollide8 = nanoRun.findRegion("nanocollide0108"); case0 = platform.findRegion("case0"); case1 = platform.findRegion("case1"); case2 = platform.findRegion("case2"); case3 = platform.findRegion("case3"); case4 = platform.findRegion("case4"); case5 = platform.findRegion("case5"); case6 = platform.findRegion("case6"); caseDefault = platform.findRegion("default"); TextureRegion[] catRun = { catRun1, catRun2, catRun3, catRun4, catRun5, catRun6, catRun7, catRun8, catRun9, catRun10, catRun11, catRun12, catRun13, catRun14, catRun15 }; catRunAnim = new Animation(.015f, catRun); catRunAnim.setPlayMode(Animation.PlayMode.LOOP); TextureRegion[] catJump = { catRun1, catRun2, catRun3, catRun4, catRun5, catRun6, catRun7, catRun8, catRun9, catRun9, catRun9, catRun9, catRun9, catRun9, catRun9, catRun9 }; catJumpAnim = new Animation(.04f, catJump); catJumpAnim.setPlayMode(Animation.PlayMode.LOOP); TextureRegion[] catCollide = { catCollide1, catCollide2, catCollide3, catCollide4, catCollide5, catCollide6, catCollide7, catCollide8 }; catCollideAnim = new Animation(.02f, catCollide); catCollideAnim.setPlayMode(Animation.PlayMode.NORMAL); fontFilter = new Texture(Gdx.files.internal("data/roboto_lt.png")); fontFilter.setFilter(TextureFilter.Linear, TextureFilter.Linear); robotoLt = new BitmapFont( Gdx.files.internal("data/roboto_lt.fnt"), new TextureRegion(fontFilter), false); robotoLt.setScale(.5f, .5f); fontFilter2 = new Texture(Gdx.files.internal("data/roboto_blk.png")); fontFilter2.setFilter(TextureFilter.Linear, TextureFilter.Linear); robotoBlk = new BitmapFont( Gdx.files.internal("data/roboto_blk.fnt"), new TextureRegion(fontFilter2), false); robotoBlk.setScale(.5f, .5f); panel = new Texture(Gdx.files.internal("data/panelcolor.png")); panel.setFilter(TextureFilter.Linear, TextureFilter.Linear); panelSprite = new Sprite(panel, 500, 300); fbShare = new Texture(Gdx.files.internal("data/fbshare.png")); fbShare.setFilter(TextureFilter.Linear, TextureFilter.Linear); fbShareSprite = new Sprite(fbShare, 199, 57); menuBack = new Texture(Gdx.files.internal("data/menu_back.png")); menuBack.setFilter(TextureFilter.Linear, TextureFilter.Linear); menuBackSprite = new Sprite(menuBack, 320, 50); collision = Gdx.audio.newSound(Gdx.files.internal("data/audio/collide.wav")); milestone = Gdx.audio.newSound(Gdx.files.internal("data/audio/milestone.wav")); milestone50 = Gdx.audio.newSound(Gdx.files.internal("data/audio/milestone50.wav")); jump = Gdx.audio.newSound(Gdx.files.internal("data/audio/nanojump.wav")); jumpSound = Gdx.audio.newSound(Gdx.files.internal("data/audio/jump_sound.wav")); dblJump = Gdx.audio.newSound(Gdx.files.internal("data/audio/nanojump2.wav")); hit = Gdx.audio.newSound(Gdx.files.internal("data/audio/hit.wav")); select = Gdx.audio.newSound(Gdx.files.internal("data/audio/select.wav")); run = Gdx.audio.newSound(Gdx.files.internal("data/audio/run.wav")); highScore = Gdx.audio.newSound(Gdx.files.internal("data/audio/highscore.wav")); // Scoring score = Gdx.app.getPreferences("NanoCat"); if (!score.contains("distance")) { score.putFloat("distance", 0); } if (!score.contains("highScore")) { score.putFloat("highScore", 0); } if (!score.contains("totalFall")) { score.putInteger("totalFall", 0); } }
public static boolean getIntroSkippable() { return options.getBoolean("introskip", false); }
public static boolean isSoundOn() { return options.getBoolean("sound", true); }
/** * Comprueba si el sonido está o no activado durante el juego * * @return */ public static boolean isSoundEnabled() { return prefs.getBoolean("sound"); }