Bug 14: Refactor, improve and finish the Storage api

This commit is contained in:
Robert Vokac 2024-09-14 10:44:27 +02:00
parent a3ab0f0b81
commit 10f571a7d8
No known key found for this signature in database
GPG Key ID: C459E1E4B4A986BB
2 changed files with 5 additions and 11 deletions

View File

@ -23,7 +23,6 @@ import com.openeggbert.core.utils.AssetsTxt;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.files.FileHandle;
import com.badlogic.gdx.graphics.Camera;
import com.badlogic.gdx.graphics.GL20;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.BitmapFont;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
@ -69,7 +68,6 @@ public class OpenEggbertGame extends Game {
private AssetsTxt assets;
private ConfigDef configDef;
private OpenEggbertDisplayMode openEggbertDisplayMode = OpenEggbertDisplayMode.WINDOW;
private Storage storage;
public OpenEggbertGame() {
this(null, null);
@ -84,13 +82,6 @@ public class OpenEggbertGame extends Game {
this.absolutePathOfRootDirectory = absolutePathOfRootDirectoryIn;
}
public Storage getStorage() {
if(storage == null) {
this.storage = Pixel.storage().getStorage();
}
return storage;
}
@Override
public void create() {

View File

@ -24,6 +24,7 @@ import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.Input;
import com.badlogic.gdx.InputAdapter;
import com.badlogic.gdx.Preferences;
import com.badlogic.gdx.files.FileHandle;
import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.graphics.g2d.BitmapFont;
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.mod.Mod;
import com.openeggbert.core.mod.ModType;
import com.pixelgamelibrary.api.Pixel;
import java.util.List;
import java.util.stream.Collectors;
import lombok.AllArgsConstructor;
@ -72,8 +74,9 @@ public class GameSpaceListScreen extends AbstractOpenEggbertScreen {
Preferences prefs = Gdx.app.getPreferences("My Preferences");
prefs.putString("test", "abc");
prefs.flush();
game.getStorage().mkdir("modes");
game.getStorage().mkdir("game_spaces");
Pixel.storage().getStorage().createDirectory("modes");
Pixel.storage().getStorage().createDirectory("gameSpaces");
Pixel.storage().getStorage().flush();
}
@Override