v0.7.4b: Initial LibGDX commit! more details below:
Large sections of game logic are now working through libgdx instead of android libraries. There is still work to do but this is the first major step. Big changes include: - Graphics code is now through LibGDX (except for text rendering) - Initialization and screen-handling logic is now mostly through LibGDX - Audio is now through LibGDX - Input handling is now through LibGDX - Most misc functions are now through LibGDX
This commit is contained in:
@@ -21,18 +21,17 @@
|
||||
|
||||
package com.watabou.utils;
|
||||
|
||||
import android.content.SharedPreferences;
|
||||
import android.os.Build;
|
||||
|
||||
import com.watabou.noosa.Game;
|
||||
import com.badlogic.gdx.Gdx;
|
||||
import com.badlogic.gdx.Preferences;
|
||||
|
||||
public class GameSettings {
|
||||
|
||||
private static SharedPreferences prefs;
|
||||
private static Preferences prefs;
|
||||
|
||||
private static SharedPreferences get() {
|
||||
private static Preferences get() {
|
||||
if (prefs == null) {
|
||||
prefs = Game.instance.getPreferences( Game.MODE_PRIVATE );
|
||||
//TODO might want to rename this file. this is the auto-generated name for android atm
|
||||
prefs = Gdx.app.getPreferences("ShatteredPixelDungeon");
|
||||
}
|
||||
return prefs;
|
||||
}
|
||||
@@ -47,7 +46,7 @@ public class GameSettings {
|
||||
|
||||
public static int getInt( String key, int defValue, int min, int max ) {
|
||||
try {
|
||||
int i = get().getInt( key, defValue );
|
||||
int i = get().getInteger( key, defValue );
|
||||
if (i < min || i > max){
|
||||
int val = (int)GameMath.gate(min, i, max);
|
||||
put(key, val);
|
||||
@@ -93,15 +92,18 @@ public class GameSettings {
|
||||
}
|
||||
|
||||
public static void put( String key, int value ) {
|
||||
get().edit().putInt(key, value).apply();
|
||||
get().putInteger(key, value);
|
||||
get().flush();
|
||||
}
|
||||
|
||||
public static void put( String key, boolean value ) {
|
||||
get().edit().putBoolean(key, value).apply();
|
||||
get().putBoolean(key, value);
|
||||
get().flush();
|
||||
}
|
||||
|
||||
public static void put( String key, String value ) {
|
||||
get().edit().putString(key, value).apply();
|
||||
get().putString(key, value);
|
||||
get().flush();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user