use of com.badlogic.gdx.Preferences in project libgdx by libgdx.
the class Lwjgl3Application method getPreferences.
@Override
public Preferences getPreferences(String name) {
if (preferences.containsKey(name)) {
return preferences.get(name);
} else {
Preferences prefs = new Lwjgl3Preferences(new Lwjgl3FileHandle(new File(config.preferencesDirectory, name), config.preferencesFileType));
preferences.put(name, prefs);
return prefs;
}
}
use of com.badlogic.gdx.Preferences in project libgdx by libgdx.
the class LwjglApplication method getPreferences.
@Override
public Preferences getPreferences(String name) {
if (preferences.containsKey(name)) {
return preferences.get(name);
} else {
Preferences prefs = new LwjglPreferences(new LwjglFileHandle(new File(preferencesdir, name), preferencesFileType));
preferences.put(name, prefs);
return prefs;
}
}
use of com.badlogic.gdx.Preferences in project libgdx by libgdx.
the class LwjglCanvas method getPreferences.
@Override
public Preferences getPreferences(String name) {
if (preferences.containsKey(name)) {
return preferences.get(name);
} else {
Preferences prefs = new LwjglPreferences(name, ".prefs/");
preferences.put(name, prefs);
return prefs;
}
}
use of com.badlogic.gdx.Preferences in project libgdx by libgdx.
the class PreferencesTest method create.
public void create() {
Preferences prefs = Gdx.app.getPreferences(".test");
if (prefs.contains("bool")) {
if (prefs.getBoolean("bool") != true)
throw new GdxRuntimeException("bool failed");
if (prefs.getInteger("int") != 1234)
throw new GdxRuntimeException("int failed");
if (prefs.getLong("long") != Long.MAX_VALUE)
throw new GdxRuntimeException("long failed");
if (prefs.getFloat("float") != 1.2345f)
throw new GdxRuntimeException("float failed");
if (!prefs.getString("string").equals("test!"))
throw new GdxRuntimeException("string failed");
}
prefs.clear();
prefs.putBoolean("bool", true);
prefs.putInteger("int", 1234);
prefs.putLong("long", Long.MAX_VALUE);
prefs.putFloat("float", 1.2345f);
prefs.putString("string", "test!");
prefs.flush();
if (prefs.getBoolean("bool") != true)
throw new GdxRuntimeException("bool failed");
if (prefs.getInteger("int") != 1234)
throw new GdxRuntimeException("int failed");
if (prefs.getLong("long") != Long.MAX_VALUE)
throw new GdxRuntimeException("long failed");
if (prefs.getFloat("float") != 1.2345f)
throw new GdxRuntimeException("float failed");
if (!prefs.getString("string").equals("test!"))
throw new GdxRuntimeException("string failed");
}
use of com.badlogic.gdx.Preferences in project AnotherMonekyParadox by SantiagoMille.
the class PantallaJuego4 method show.
@Override
public void show() {
crearCamara();
crearMapa();
// personaje = new Personaje(astroCaminata0, astroCaminata1, astroCaminata2, astroCaminata3);
fondo1 = new Fondo(fondoNivel01);
fondo2 = new Fondo(fondoNivel02);
fondo2.getImagenA().setPosition(fondo1.getImagenA().getWidth(), 0);
Preferences prefs = Gdx.app.getPreferences("AnotherMonkeyPreferenceStory");
difficulty = prefs.getFloat("Difficulty");
batch = new SpriteBatch();
// Lista Enemigos
listaEnemigos = new Array<Enemigo>();
for (int i = 0; i < 10; i++) {
enemigo = new Enemigo(alien01Frame0, alien01Frame1, alien01Frame2, alien01Frame3, true, i);
listaEnemigos.add(enemigo);
}
for (int i = 0; i < 10; i++) {
enemigo = new Enemigo(alien01Frame0, alien01Frame1, alien01Frame2, alien01Frame3, false, i);
listaEnemigos.add(enemigo);
}
// Lista Balas
listaBalas = new Array<Bala>();
listaBalasBoss = new Array<Bala>();
// Lista Granadas
listaGranadas = new Array<Granada>();
estado = PantallaJuego.EstadoJuego.JUGANDO;
Gdx.input.setCatchBackKey(true);
musicNivel4.setLooping(true);
if (prefs.getBoolean("music", true)) {
musicNivel4.play();
}
// Gdx.input.setInputProcessor(new ProcesadorEntrada());
}
Aggregations