Bug 14: Refactor, improve and finish the Storage api
This commit is contained in:
parent
a3ab0f0b81
commit
10f571a7d8
@ -23,7 +23,6 @@ import com.openeggbert.core.utils.AssetsTxt;
|
|||||||
import com.badlogic.gdx.Gdx;
|
import com.badlogic.gdx.Gdx;
|
||||||
import com.badlogic.gdx.files.FileHandle;
|
import com.badlogic.gdx.files.FileHandle;
|
||||||
import com.badlogic.gdx.graphics.Camera;
|
import com.badlogic.gdx.graphics.Camera;
|
||||||
import com.badlogic.gdx.graphics.GL20;
|
|
||||||
import com.badlogic.gdx.graphics.Texture;
|
import com.badlogic.gdx.graphics.Texture;
|
||||||
import com.badlogic.gdx.graphics.g2d.BitmapFont;
|
import com.badlogic.gdx.graphics.g2d.BitmapFont;
|
||||||
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
|
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
|
||||||
@ -69,7 +68,6 @@ public class OpenEggbertGame extends Game {
|
|||||||
private AssetsTxt assets;
|
private AssetsTxt assets;
|
||||||
private ConfigDef configDef;
|
private ConfigDef configDef;
|
||||||
private OpenEggbertDisplayMode openEggbertDisplayMode = OpenEggbertDisplayMode.WINDOW;
|
private OpenEggbertDisplayMode openEggbertDisplayMode = OpenEggbertDisplayMode.WINDOW;
|
||||||
private Storage storage;
|
|
||||||
|
|
||||||
public OpenEggbertGame() {
|
public OpenEggbertGame() {
|
||||||
this(null, null);
|
this(null, null);
|
||||||
@ -84,13 +82,6 @@ public class OpenEggbertGame extends Game {
|
|||||||
this.absolutePathOfRootDirectory = absolutePathOfRootDirectoryIn;
|
this.absolutePathOfRootDirectory = absolutePathOfRootDirectoryIn;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Storage getStorage() {
|
|
||||||
if(storage == null) {
|
|
||||||
this.storage = Pixel.storage().getStorage();
|
|
||||||
}
|
|
||||||
return storage;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void create() {
|
public void create() {
|
||||||
|
@ -24,6 +24,7 @@ import com.badlogic.gdx.Gdx;
|
|||||||
import com.badlogic.gdx.Input;
|
import com.badlogic.gdx.Input;
|
||||||
import com.badlogic.gdx.InputAdapter;
|
import com.badlogic.gdx.InputAdapter;
|
||||||
import com.badlogic.gdx.Preferences;
|
import com.badlogic.gdx.Preferences;
|
||||||
|
import com.badlogic.gdx.files.FileHandle;
|
||||||
import com.badlogic.gdx.graphics.Color;
|
import com.badlogic.gdx.graphics.Color;
|
||||||
import com.badlogic.gdx.graphics.g2d.BitmapFont;
|
import com.badlogic.gdx.graphics.g2d.BitmapFont;
|
||||||
import com.badlogic.gdx.graphics.glutils.ShapeRenderer;
|
import com.badlogic.gdx.graphics.glutils.ShapeRenderer;
|
||||||
@ -32,6 +33,7 @@ import com.openeggbert.core.gamespace.GameSpace;
|
|||||||
import com.openeggbert.core.main.OpenEggbertGame;
|
import com.openeggbert.core.main.OpenEggbertGame;
|
||||||
import com.openeggbert.core.mod.Mod;
|
import com.openeggbert.core.mod.Mod;
|
||||||
import com.openeggbert.core.mod.ModType;
|
import com.openeggbert.core.mod.ModType;
|
||||||
|
import com.pixelgamelibrary.api.Pixel;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
@ -72,8 +74,9 @@ public class GameSpaceListScreen extends AbstractOpenEggbertScreen {
|
|||||||
Preferences prefs = Gdx.app.getPreferences("My Preferences");
|
Preferences prefs = Gdx.app.getPreferences("My Preferences");
|
||||||
prefs.putString("test", "abc");
|
prefs.putString("test", "abc");
|
||||||
prefs.flush();
|
prefs.flush();
|
||||||
game.getStorage().mkdir("modes");
|
Pixel.storage().getStorage().createDirectory("modes");
|
||||||
game.getStorage().mkdir("game_spaces");
|
Pixel.storage().getStorage().createDirectory("gameSpaces");
|
||||||
|
Pixel.storage().getStorage().flush();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
Reference in New Issue
Block a user