Storage was replaced by FileSystem
This commit is contained in:
parent
3c397e354f
commit
f8fb47bc72
5
build.sh
5
build.sh
@ -1 +1,6 @@
|
|||||||
|
|
||||||
|
if [ `whoami` = "robertvokac" ]; then
|
||||||
|
export JAVA_HOME=/home/robertvokac/Desktop/jdk-17.0.2/
|
||||||
|
fi
|
||||||
|
|
||||||
./gradlew build $1
|
./gradlew build $1
|
@ -17,11 +17,11 @@ import com.pixelgamelibrary.api.Pixel;
|
|||||||
import com.pixelgamelibrary.api.graphics.BitmapFont;
|
import com.pixelgamelibrary.api.graphics.BitmapFont;
|
||||||
import com.pixelgamelibrary.api.graphics.SpriteBatch;
|
import com.pixelgamelibrary.api.graphics.SpriteBatch;
|
||||||
import com.pixelgamelibrary.api.graphics.Texture;
|
import com.pixelgamelibrary.api.graphics.Texture;
|
||||||
import com.pixelgamelibrary.api.storage.FileHandle;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import lombok.Data;
|
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()) {
|
// for(FileHandle f:Gdx.files.internal(".").list()) {
|
||||||
// System.out.println("assets contains also: " + f.name());
|
// 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.exists=" + embeddedModsDirectory.exists());
|
||||||
System.out.println("embeddedModsDirectory.list().size()=" + embeddedModsDirectory.list().size());
|
System.out.println("embeddedModsDirectory.list().size()=" + embeddedModsDirectory.list().size());
|
||||||
embeddedModsDirectory.list().forEach(e -> System.out.println(e.path()));
|
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")) {
|
if (embeddedModGroup.name().equals("README.md")) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
System.out.println("Found group " + embeddedModGroup.name());
|
System.out.println("Found group " + embeddedModGroup.name());
|
||||||
for (FileHandle embeddedMod : embeddedModGroup.list()) {
|
for (File embeddedMod : embeddedModGroup.list()) {
|
||||||
System.out.println("Found mod " + embeddedMod.name());
|
System.out.println("Found mod " + embeddedMod.name());
|
||||||
|
|
||||||
FileHandle modXml = null;
|
File modXml = null;
|
||||||
for (FileHandle file : embeddedMod.list()) {
|
for (File file : embeddedMod.list()) {
|
||||||
if (file.name().equals("mod.xml")) {
|
if (file.name().equals("mod.xml")) {
|
||||||
modXml = file;
|
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);
|
Texture texture = Pixel.graphics().newTexture(fileHandle);
|
||||||
if(!fileHandle.exists()) {
|
if(!fileHandle.exists()) {
|
||||||
throw new OpenEggbertException("File does not exist: " + fileHandle.path());
|
throw new OpenEggbertException("File does not exist: " + fileHandle.path());
|
||||||
|
@ -33,13 +33,13 @@ import com.openeggbert.core.mod.Mod;
|
|||||||
import com.openeggbert.core.mod.ModType;
|
import com.openeggbert.core.mod.ModType;
|
||||||
import com.pixelgamelibrary.api.Pixel;
|
import com.pixelgamelibrary.api.Pixel;
|
||||||
import com.pixelgamelibrary.api.graphics.BitmapFont;
|
import com.pixelgamelibrary.api.graphics.BitmapFont;
|
||||||
import com.pixelgamelibrary.api.storage.Storage;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
import lombok.ToString;
|
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");
|
Preferences prefs = Gdx.app.getPreferences("My Preferences");
|
||||||
prefs.putString("test", "abc");
|
prefs.putString("test", "abc");
|
||||||
prefs.flush();
|
prefs.flush();
|
||||||
final Storage storage = Pixel.files().localStorage();
|
final FileSystem storage = Pixel.files().localFileSystem();
|
||||||
storage.createDirectory("modes");
|
storage.createDirectory("modes");
|
||||||
storage.createDirectory("gameSpaces");
|
storage.createDirectory("gameSpaces");
|
||||||
System.out.println(storage.debug());
|
System.out.println(storage.debug());
|
||||||
|
@ -28,9 +28,9 @@ import com.pixelgamelibrary.api.app.LogLevel;
|
|||||||
import com.pixelgamelibrary.api.graphics.SpriteBatch;
|
import com.pixelgamelibrary.api.graphics.SpriteBatch;
|
||||||
import com.pixelgamelibrary.api.graphics.Texture;
|
import com.pixelgamelibrary.api.graphics.Texture;
|
||||||
import com.pixelgamelibrary.api.screen.ScreenAdapter;
|
import com.pixelgamelibrary.api.screen.ScreenAdapter;
|
||||||
import com.pixelgamelibrary.api.storage.FileHandle;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
import com.pixelgamelibrary.api.files.File;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@ -73,7 +73,7 @@ public abstract class OpenEggbertScreen extends ScreenAdapter {
|
|||||||
String fileName = getBackgroundFileName();
|
String fileName = getBackgroundFileName();
|
||||||
if(getScreenType().isPresent() && getScreenType().get().isBasic()) {
|
if(getScreenType().isPresent() && getScreenType().get().isBasic()) {
|
||||||
if (!game.existsImageTexture("BASIC")) {
|
if (!game.existsImageTexture("BASIC")) {
|
||||||
FileHandle fileHandle;
|
File fileHandle;
|
||||||
if (Pixel.app().isOneOfPlatforms(Platform.ANDROID, Platform.WEB)) {
|
if (Pixel.app().isOneOfPlatforms(Platform.ANDROID, Platform.WEB)) {
|
||||||
Pixel.app().log("screen","loading from internal");
|
Pixel.app().log("screen","loading from internal");
|
||||||
fileHandle = Pixel.files().assets("BASIC/BASIC.PNG");
|
fileHandle = Pixel.files().assets("BASIC/BASIC.PNG");
|
||||||
@ -93,7 +93,7 @@ public abstract class OpenEggbertScreen extends ScreenAdapter {
|
|||||||
|
|
||||||
Pixel.app().setLogLevel(LogLevel.INFO);
|
Pixel.app().setLogLevel(LogLevel.INFO);
|
||||||
Pixel.app().log("screen","name=" + name);
|
Pixel.app().log("screen","name=" + name);
|
||||||
FileHandle fileHandle = null;
|
File fileHandle = null;
|
||||||
if (game.getGameSpace().isEmbeddedAssets()) {
|
if (game.getGameSpace().isEmbeddedAssets()) {
|
||||||
|
|
||||||
if (Pixel.app().isOneOfPlatforms(Platform.ANDROID, Platform.WEB)) {
|
if (Pixel.app().isOneOfPlatforms(Platform.ANDROID, Platform.WEB)) {
|
||||||
|
@ -19,14 +19,14 @@
|
|||||||
///////////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
package com.openeggbert.lwjgl3.debugging;
|
package com.openeggbert.lwjgl3.debugging;
|
||||||
|
|
||||||
import com.pixelgamelibrary.api.storage.command.CommandLineScanner;
|
import com.pixelgamelibrary.api.files.shell.ShellScanner;
|
||||||
import java.util.Scanner;
|
import java.util.Scanner;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author robertvokac
|
* @author robertvokac
|
||||||
*/
|
*/
|
||||||
public class DesktopCommandLineScanner implements CommandLineScanner {
|
public class DesktopCommandLineScanner implements ShellScanner {
|
||||||
|
|
||||||
private final Scanner scanner;
|
private final Scanner scanner;
|
||||||
|
|
||||||
|
@ -19,9 +19,9 @@
|
|||||||
///////////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
package com.openeggbert.lwjgl3.debugging;
|
package com.openeggbert.lwjgl3.debugging;
|
||||||
|
|
||||||
import com.pixelgamelibrary.api.storage.command.StorageCommandLine;
|
import com.pixelgamelibrary.api.files.shell.ShellCommandLine;
|
||||||
import com.pixelgamelibrary.api.storage.command.StorageCommandLineScanner;
|
import com.pixelgamelibrary.api.files.shell.ShellCommandLineScanner;
|
||||||
import com.pixelgamelibrary.api.storage.map.MemoryStorage;
|
import com.pixelgamelibrary.api.files.map.MemoryFileSystem;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@ -34,11 +34,11 @@ public class DesktopStorageCommandLineScanner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
MemoryStorage memoryStorage = new MemoryStorage();
|
MemoryFileSystem memoryStorage = new MemoryFileSystem();
|
||||||
final String user = "player";
|
final String user = "player";
|
||||||
final String hostname = "openegggbert";
|
final String hostname = "openegggbert";
|
||||||
StorageCommandLine storageCommandLine = new StorageCommandLine(user, hostname, memoryStorage);
|
ShellCommandLine storageCommandLine = new ShellCommandLine(user, hostname, memoryStorage);
|
||||||
StorageCommandLineScanner storageCommandLineScanner = new StorageCommandLineScanner(
|
ShellCommandLineScanner shellCommandLineScanner = new ShellCommandLineScanner(
|
||||||
storageCommandLine, new DesktopCommandLineScanner());
|
storageCommandLine, new DesktopCommandLineScanner());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user