Storage was replaced by FileSystem

This commit is contained in:
Robert Vokac 2024-10-12 09:12:21 +02:00
parent 3c397e354f
commit f8fb47bc72
Signed by: robertvokac
GPG Key ID: FB9CE8E20AADA55F
6 changed files with 26 additions and 21 deletions

View File

@ -1 +1,6 @@
if [ `whoami` = "robertvokac" ]; then
export JAVA_HOME=/home/robertvokac/Desktop/jdk-17.0.2/
fi
./gradlew build $1

View File

@ -17,11 +17,11 @@ import com.pixelgamelibrary.api.Pixel;
import com.pixelgamelibrary.api.graphics.BitmapFont;
import com.pixelgamelibrary.api.graphics.SpriteBatch;
import com.pixelgamelibrary.api.graphics.Texture;
import com.pixelgamelibrary.api.storage.FileHandle;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
import lombok.Data;
import com.pixelgamelibrary.api.files.File;
/**
*
@ -73,23 +73,23 @@ public class OpenEggbertGame extends GameAdapter {
// for(FileHandle f:Gdx.files.internal(".").list()) {
// System.out.println("assets contains also: " + f.name());
// }
com.pixelgamelibrary.api.storage.FileHandle embeddedModsDirectory = Pixel.files().assets("/embedded_mods");
com.pixelgamelibrary.api.files.File embeddedModsDirectory = Pixel.files().assets("/embedded_mods");
System.out.println("embeddedModsDirectory.exists=" + embeddedModsDirectory.exists());
System.out.println("embeddedModsDirectory.list().size()=" + embeddedModsDirectory.list().size());
embeddedModsDirectory.list().forEach(e -> System.out.println(e.path()));
Pixel.files().assetsStorage().list().forEach(e -> System.out.println(e));
Pixel.files().assetsFileSystem().list().forEach(e -> System.out.println(e));
for (FileHandle embeddedModGroup : embeddedModsDirectory.list()) {
for (File embeddedModGroup : embeddedModsDirectory.list()) {
if (embeddedModGroup.name().equals("README.md")) {
continue;
}
System.out.println("Found group " + embeddedModGroup.name());
for (FileHandle embeddedMod : embeddedModGroup.list()) {
for (File embeddedMod : embeddedModGroup.list()) {
System.out.println("Found mod " + embeddedMod.name());
FileHandle modXml = null;
for (FileHandle file : embeddedMod.list()) {
File modXml = null;
for (File file : embeddedMod.list()) {
if (file.name().equals("mod.xml")) {
modXml = file;
}
@ -133,7 +133,7 @@ public class OpenEggbertGame extends GameAdapter {
}
}
public void loadImageTexture(FileHandle fileHandle) {
public void loadImageTexture(File fileHandle) {
Texture texture = Pixel.graphics().newTexture(fileHandle);
if(!fileHandle.exists()) {
throw new OpenEggbertException("File does not exist: " + fileHandle.path());

View File

@ -33,13 +33,13 @@ import com.openeggbert.core.mod.Mod;
import com.openeggbert.core.mod.ModType;
import com.pixelgamelibrary.api.Pixel;
import com.pixelgamelibrary.api.graphics.BitmapFont;
import com.pixelgamelibrary.api.storage.Storage;
import java.util.List;
import java.util.Optional;
import java.util.stream.Collectors;
import lombok.AllArgsConstructor;
import lombok.NoArgsConstructor;
import lombok.ToString;
import com.pixelgamelibrary.api.files.FileSystem;
/**
*
@ -74,7 +74,7 @@ public class GameSpaceListScreen extends AbstractBasicScreen {
Preferences prefs = Gdx.app.getPreferences("My Preferences");
prefs.putString("test", "abc");
prefs.flush();
final Storage storage = Pixel.files().localStorage();
final FileSystem storage = Pixel.files().localFileSystem();
storage.createDirectory("modes");
storage.createDirectory("gameSpaces");
System.out.println(storage.debug());

View File

@ -28,9 +28,9 @@ import com.pixelgamelibrary.api.app.LogLevel;
import com.pixelgamelibrary.api.graphics.SpriteBatch;
import com.pixelgamelibrary.api.graphics.Texture;
import com.pixelgamelibrary.api.screen.ScreenAdapter;
import com.pixelgamelibrary.api.storage.FileHandle;
import java.util.List;
import java.util.Optional;
import com.pixelgamelibrary.api.files.File;
/**
*
@ -73,7 +73,7 @@ public abstract class OpenEggbertScreen extends ScreenAdapter {
String fileName = getBackgroundFileName();
if(getScreenType().isPresent() && getScreenType().get().isBasic()) {
if (!game.existsImageTexture("BASIC")) {
FileHandle fileHandle;
File fileHandle;
if (Pixel.app().isOneOfPlatforms(Platform.ANDROID, Platform.WEB)) {
Pixel.app().log("screen","loading from internal");
fileHandle = Pixel.files().assets("BASIC/BASIC.PNG");
@ -93,7 +93,7 @@ public abstract class OpenEggbertScreen extends ScreenAdapter {
Pixel.app().setLogLevel(LogLevel.INFO);
Pixel.app().log("screen","name=" + name);
FileHandle fileHandle = null;
File fileHandle = null;
if (game.getGameSpace().isEmbeddedAssets()) {
if (Pixel.app().isOneOfPlatforms(Platform.ANDROID, Platform.WEB)) {

View File

@ -19,14 +19,14 @@
///////////////////////////////////////////////////////////////////////////////////////////////
package com.openeggbert.lwjgl3.debugging;
import com.pixelgamelibrary.api.storage.command.CommandLineScanner;
import com.pixelgamelibrary.api.files.shell.ShellScanner;
import java.util.Scanner;
/**
*
* @author robertvokac
*/
public class DesktopCommandLineScanner implements CommandLineScanner {
public class DesktopCommandLineScanner implements ShellScanner {
private final Scanner scanner;

View File

@ -19,9 +19,9 @@
///////////////////////////////////////////////////////////////////////////////////////////////
package com.openeggbert.lwjgl3.debugging;
import com.pixelgamelibrary.api.storage.command.StorageCommandLine;
import com.pixelgamelibrary.api.storage.command.StorageCommandLineScanner;
import com.pixelgamelibrary.api.storage.map.MemoryStorage;
import com.pixelgamelibrary.api.files.shell.ShellCommandLine;
import com.pixelgamelibrary.api.files.shell.ShellCommandLineScanner;
import com.pixelgamelibrary.api.files.map.MemoryFileSystem;
/**
*
@ -34,11 +34,11 @@ public class DesktopStorageCommandLineScanner {
}
public static void main(String[] args) {
MemoryStorage memoryStorage = new MemoryStorage();
MemoryFileSystem memoryStorage = new MemoryFileSystem();
final String user = "player";
final String hostname = "openegggbert";
StorageCommandLine storageCommandLine = new StorageCommandLine(user, hostname, memoryStorage);
StorageCommandLineScanner storageCommandLineScanner = new StorageCommandLineScanner(
ShellCommandLine storageCommandLine = new ShellCommandLine(user, hostname, memoryStorage);
ShellCommandLineScanner shellCommandLineScanner = new ShellCommandLineScanner(
storageCommandLine, new DesktopCommandLineScanner());
}