From 51d7579f8aa6799df50ee3cc88a96ea7132f7207 Mon Sep 17 00:00:00 2001 From: Robert Vokac Date: Wed, 18 Sep 2024 18:15:12 +0200 Subject: [PATCH] Changes --- .../backend/libgdx/AppLibGDXImpl.java | 46 ++++++++-- .../backend/libgdx/AssetLibGDXImpl.java | 43 ---------- .../backend/libgdx/AudioLibGDXImpl.java | 4 +- .../backend/libgdx/FilesLibGDXImpl.java | 83 +++++++++++++++++++ .../backend/libgdx/GraphicsLibGDXImpl.java | 10 ++- .../backend/libgdx/InputLibGDXImpl.java | 4 +- .../backend/libgdx/InternalLibGDXImpl.java | 4 +- .../backend/libgdx/NetLibGDXImpl.java | 4 +- .../backend/libgdx/PixelBackendLibGDX.java | 65 ++++++--------- .../backend/libgdx/StorageLibGDXImpl.java | 39 --------- .../backend/libgdx/UtilsLibGDXImpl.java | 22 +++-- .../libgdx/assets/AssetsLibGDXStorage.java | 36 ++++++++ .../backend/libgdx/game/LibGdxGame.java | 12 +-- .../backend/libgdx/screen/LibGdxScreen.java | 8 +- .../libgdx/storage/DesktopAndroidStorage.java | 37 +++++++++ .../storage/DesktopAndroidStorageTest.java | 80 ++++++++++++------ 16 files changed, 320 insertions(+), 177 deletions(-) delete mode 100644 src/main/java/com/pixelgamelibrary/backend/libgdx/AssetLibGDXImpl.java create mode 100644 src/main/java/com/pixelgamelibrary/backend/libgdx/FilesLibGDXImpl.java delete mode 100644 src/main/java/com/pixelgamelibrary/backend/libgdx/StorageLibGDXImpl.java diff --git a/src/main/java/com/pixelgamelibrary/backend/libgdx/AppLibGDXImpl.java b/src/main/java/com/pixelgamelibrary/backend/libgdx/AppLibGDXImpl.java index 9331042..a8b1307 100644 --- a/src/main/java/com/pixelgamelibrary/backend/libgdx/AppLibGDXImpl.java +++ b/src/main/java/com/pixelgamelibrary/backend/libgdx/AppLibGDXImpl.java @@ -25,21 +25,25 @@ import static com.badlogic.gdx.Application.ApplicationType.Desktop; import static com.badlogic.gdx.Application.ApplicationType.WebGL; import static com.badlogic.gdx.Application.ApplicationType.iOS; import com.badlogic.gdx.Gdx; -import com.pixelgamelibrary.api.GameI; import com.pixelgamelibrary.api.PixelException; import com.pixelgamelibrary.api.Platform; -import com.pixelgamelibrary.api.interfaces.AppI; +import com.pixelgamelibrary.api.interfaces.App; +import com.pixelgamelibrary.api.Game; +import com.pixelgamelibrary.api.PixelFeature; +import com.pixelgamelibrary.api.utils.ClipBoard; +import com.pixelgamelibrary.api.utils.LogLevel; +import com.pixelgamelibrary.api.utils.Preferences; /** * * @author robertvokac */ -public class AppLibGDXImpl implements AppI { +public class AppLibGDXImpl implements App { private static final String DEFAULT_APP_NAME = "pixel-app"; private String appName = null; - private GameI game; + private Game game; @Override public void exit() { @@ -112,13 +116,43 @@ public class AppLibGDXImpl implements AppI { } @Override - public void setGame(GameI game) { + public void setGame(Game game) { this.game = game; } @Override - public GameI getGame() { + public Game getGame() { return game; } + @Override + public void setLogLevel(LogLevel logLevel) { + throw new UnsupportedOperationException("Not supported yet."); // Generated from nbfs://nbhost/SystemFileSystem/Templates/Classes/Code/GeneratedMethodBody + } + + @Override + public Preferences getPreferences(String preferencesName) { + throw new UnsupportedOperationException("Not supported yet."); // Generated from nbfs://nbhost/SystemFileSystem/Templates/Classes/Code/GeneratedMethodBody + } + + @Override + public boolean isFeatureEnabled(PixelFeature feature) { + throw new UnsupportedOperationException("Not supported yet."); // Generated from nbfs://nbhost/SystemFileSystem/Templates/Classes/Code/GeneratedMethodBody + } + + @Override + public boolean isMobileDevice() { + throw new UnsupportedOperationException("Not supported yet."); // Generated from nbfs://nbhost/SystemFileSystem/Templates/Classes/Code/GeneratedMethodBody + } + + @Override + public void postRunnable(Runnable runnable) { + throw new UnsupportedOperationException("Not supported yet."); // Generated from nbfs://nbhost/SystemFileSystem/Templates/Classes/Code/GeneratedMethodBody + } + + @Override + public ClipBoard getClipBoard() { + throw new UnsupportedOperationException("Not supported yet."); // Generated from nbfs://nbhost/SystemFileSystem/Templates/Classes/Code/GeneratedMethodBody + } + } diff --git a/src/main/java/com/pixelgamelibrary/backend/libgdx/AssetLibGDXImpl.java b/src/main/java/com/pixelgamelibrary/backend/libgdx/AssetLibGDXImpl.java deleted file mode 100644 index 2d6b981..0000000 --- a/src/main/java/com/pixelgamelibrary/backend/libgdx/AssetLibGDXImpl.java +++ /dev/null @@ -1,43 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////////////////////// -// Pixel: Game library. -// Copyright (C) 2024 the original author or authors. -// -// This program is free software: you can redistribute it and/or -// modify it under the terms of the GNU General Public License -// as published by the Free Software Foundation, either version 3 -// of the License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program. If not, see -// or write to the Free Software -// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -/////////////////////////////////////////////////////////////////////////////////////////////// -package com.pixelgamelibrary.backend.libgdx; - -import com.pixelgamelibrary.api.interfaces.AssetI; -import com.pixelgamelibrary.api.storage.Storage; -import com.pixelgamelibrary.backend.libgdx.assets.AssetsLibGDXStorage; - -/** - * - * @author robertvokac - */ -public class AssetLibGDXImpl implements AssetI { - - Storage assetsStorage = null; - @Override - public Storage getAssets() { - if(assetsStorage == null) { - assetsStorage = new AssetsLibGDXStorage(); - } - return assetsStorage; - } - - - -} diff --git a/src/main/java/com/pixelgamelibrary/backend/libgdx/AudioLibGDXImpl.java b/src/main/java/com/pixelgamelibrary/backend/libgdx/AudioLibGDXImpl.java index 00c55db..51a93f1 100644 --- a/src/main/java/com/pixelgamelibrary/backend/libgdx/AudioLibGDXImpl.java +++ b/src/main/java/com/pixelgamelibrary/backend/libgdx/AudioLibGDXImpl.java @@ -19,13 +19,13 @@ /////////////////////////////////////////////////////////////////////////////////////////////// package com.pixelgamelibrary.backend.libgdx; -import com.pixelgamelibrary.api.interfaces.AudioI; +import com.pixelgamelibrary.api.interfaces.Audio; /** * * @author robertvokac */ -public class AudioLibGDXImpl implements AudioI { +public class AudioLibGDXImpl implements Audio { diff --git a/src/main/java/com/pixelgamelibrary/backend/libgdx/FilesLibGDXImpl.java b/src/main/java/com/pixelgamelibrary/backend/libgdx/FilesLibGDXImpl.java new file mode 100644 index 0000000..c446f3a --- /dev/null +++ b/src/main/java/com/pixelgamelibrary/backend/libgdx/FilesLibGDXImpl.java @@ -0,0 +1,83 @@ +/////////////////////////////////////////////////////////////////////////////////////////////// +// Pixel: Game library. +// Copyright (C) 2024 the original author or authors. +// +// This program is free software: you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation, either version 3 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see +// or write to the Free Software +// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +/////////////////////////////////////////////////////////////////////////////////////////////// +package com.pixelgamelibrary.backend.libgdx; + +import com.pixelgamelibrary.backend.libgdx.storage.StorageFactory; +import com.pixelgamelibrary.api.storage.Storage; +import com.pixelgamelibrary.api.interfaces.Files; +import com.pixelgamelibrary.backend.libgdx.assets.AssetsLibGDXStorage; + +/** + * + * @author robertvokac + */ +public class FilesLibGDXImpl implements Files { + Storage assetsStorage = null; + + @Override + public Storage local() { + return StorageFactory.getStorage(); + } + + @Override + public Storage assets() { + if(assetsStorage == null) { + assetsStorage = new AssetsLibGDXStorage(); + } + return assetsStorage; } + + @Override + public Storage external() { + throw new UnsupportedOperationException("Not supported yet."); // Generated from nbfs://nbhost/SystemFileSystem/Templates/Classes/Code/GeneratedMethodBody + } + + @Override + public Storage relative(String absolutePath) { + throw new UnsupportedOperationException("Not supported yet."); // Generated from nbfs://nbhost/SystemFileSystem/Templates/Classes/Code/GeneratedMethodBody + } + + @Override + public Storage absolute() { + throw new UnsupportedOperationException("Not supported yet."); // Generated from nbfs://nbhost/SystemFileSystem/Templates/Classes/Code/GeneratedMethodBody + } + + @Override + public Storage tmp() { + throw new UnsupportedOperationException("Not supported yet."); // Generated from nbfs://nbhost/SystemFileSystem/Templates/Classes/Code/GeneratedMethodBody + } + + @Override + public boolean isExternalStorageAvailable() { + throw new UnsupportedOperationException("Not supported yet."); // Generated from nbfs://nbhost/SystemFileSystem/Templates/Classes/Code/GeneratedMethodBody + } + + @Override + public String getLocalStoragePath() { + throw new UnsupportedOperationException("Not supported yet."); // Generated from nbfs://nbhost/SystemFileSystem/Templates/Classes/Code/GeneratedMethodBody + } + + @Override + public String getExternalStoragePath() { + throw new UnsupportedOperationException("Not supported yet."); // Generated from nbfs://nbhost/SystemFileSystem/Templates/Classes/Code/GeneratedMethodBody + } + + + +} diff --git a/src/main/java/com/pixelgamelibrary/backend/libgdx/GraphicsLibGDXImpl.java b/src/main/java/com/pixelgamelibrary/backend/libgdx/GraphicsLibGDXImpl.java index 17af34b..1178ece 100644 --- a/src/main/java/com/pixelgamelibrary/backend/libgdx/GraphicsLibGDXImpl.java +++ b/src/main/java/com/pixelgamelibrary/backend/libgdx/GraphicsLibGDXImpl.java @@ -23,16 +23,17 @@ import com.badlogic.gdx.Gdx; import com.badlogic.gdx.Graphics; import com.pixelgamelibrary.api.WindowMode; import com.pixelgamelibrary.api.PixelException; +import com.pixelgamelibrary.api.utils.Monitor; import java.util.Arrays; import java.util.List; import java.util.stream.Collectors; -import com.pixelgamelibrary.api.interfaces.GraphicsI; +//import com.pixelgamelibrary.api.interfaces.Graphics; /** * * @author robertvokac */ -public class GraphicsLibGDXImpl implements GraphicsI { +public class GraphicsLibGDXImpl implements com.pixelgamelibrary.api.interfaces.Graphics { @Override @@ -94,4 +95,9 @@ public class GraphicsLibGDXImpl implements GraphicsI { private Graphics.DisplayMode originalDisplayMode = null; + @Override + public List getMonitors() { + throw new UnsupportedOperationException("Not supported yet."); // Generated from nbfs://nbhost/SystemFileSystem/Templates/Classes/Code/GeneratedMethodBody + } + } diff --git a/src/main/java/com/pixelgamelibrary/backend/libgdx/InputLibGDXImpl.java b/src/main/java/com/pixelgamelibrary/backend/libgdx/InputLibGDXImpl.java index cddd0b4..e394756 100644 --- a/src/main/java/com/pixelgamelibrary/backend/libgdx/InputLibGDXImpl.java +++ b/src/main/java/com/pixelgamelibrary/backend/libgdx/InputLibGDXImpl.java @@ -19,13 +19,13 @@ /////////////////////////////////////////////////////////////////////////////////////////////// package com.pixelgamelibrary.backend.libgdx; -import com.pixelgamelibrary.api.interfaces.InputI; +import com.pixelgamelibrary.api.interfaces.Input; /** * * @author robertvokac */ -public class InputLibGDXImpl implements InputI { +public class InputLibGDXImpl implements Input { diff --git a/src/main/java/com/pixelgamelibrary/backend/libgdx/InternalLibGDXImpl.java b/src/main/java/com/pixelgamelibrary/backend/libgdx/InternalLibGDXImpl.java index 99723d7..580a5cd 100644 --- a/src/main/java/com/pixelgamelibrary/backend/libgdx/InternalLibGDXImpl.java +++ b/src/main/java/com/pixelgamelibrary/backend/libgdx/InternalLibGDXImpl.java @@ -19,13 +19,13 @@ /////////////////////////////////////////////////////////////////////////////////////////////// package com.pixelgamelibrary.backend.libgdx; -import com.pixelgamelibrary.api.interfaces.InternalI; +import com.pixelgamelibrary.api.interfaces.Internal; /** * * @author robertvokac */ -public class InternalLibGDXImpl implements InternalI { +public class InternalLibGDXImpl implements Internal { diff --git a/src/main/java/com/pixelgamelibrary/backend/libgdx/NetLibGDXImpl.java b/src/main/java/com/pixelgamelibrary/backend/libgdx/NetLibGDXImpl.java index 38c5f21..3881540 100644 --- a/src/main/java/com/pixelgamelibrary/backend/libgdx/NetLibGDXImpl.java +++ b/src/main/java/com/pixelgamelibrary/backend/libgdx/NetLibGDXImpl.java @@ -19,13 +19,13 @@ /////////////////////////////////////////////////////////////////////////////////////////////// package com.pixelgamelibrary.backend.libgdx; -import com.pixelgamelibrary.api.interfaces.NetI; +import com.pixelgamelibrary.api.interfaces.Net; /** * * @author robertvokac */ -public class NetLibGDXImpl implements NetI { +public class NetLibGDXImpl implements Net { diff --git a/src/main/java/com/pixelgamelibrary/backend/libgdx/PixelBackendLibGDX.java b/src/main/java/com/pixelgamelibrary/backend/libgdx/PixelBackendLibGDX.java index 5811b64..d043e5d 100644 --- a/src/main/java/com/pixelgamelibrary/backend/libgdx/PixelBackendLibGDX.java +++ b/src/main/java/com/pixelgamelibrary/backend/libgdx/PixelBackendLibGDX.java @@ -19,16 +19,15 @@ /////////////////////////////////////////////////////////////////////////////////////////////// package com.pixelgamelibrary.backend.libgdx; -import com.pixelgamelibrary.api.interfaces.AppI; -import com.pixelgamelibrary.api.interfaces.AssetI; -import com.pixelgamelibrary.api.interfaces.AudioI; -import com.pixelgamelibrary.api.interfaces.GraphicsI; -import com.pixelgamelibrary.api.interfaces.InputI; -import com.pixelgamelibrary.api.interfaces.InternalI; -import com.pixelgamelibrary.api.interfaces.UtilsI; -import com.pixelgamelibrary.api.interfaces.StorageI; -import com.pixelgamelibrary.api.interfaces.NetI; import com.pixelgamelibrary.api.interfaces.PixelBackend; +import com.pixelgamelibrary.api.interfaces.Files; +import com.pixelgamelibrary.api.interfaces.Audio; +import com.pixelgamelibrary.api.interfaces.Graphics; +import com.pixelgamelibrary.api.interfaces.Input; +import com.pixelgamelibrary.api.interfaces.Internal; +import com.pixelgamelibrary.api.interfaces.Net; +import com.pixelgamelibrary.api.interfaces.Utils; +import com.pixelgamelibrary.api.interfaces.App; /** * @@ -36,19 +35,18 @@ import com.pixelgamelibrary.api.interfaces.PixelBackend; */ public class PixelBackendLibGDX implements PixelBackend { - private AppI pixelAppLibGdxImpl = null; - private GraphicsI pixelGraphicsLibGdxImpl = null; - private AudioI pixelAudioLibGdxImpl = null; - private InputI pixelInputLibGdxImpl = null; - private NetI pixelNetLibGdxImpl = null; - private AssetI pixelAssetLibGdxImpl = null; - private StorageI pixelStorageLibGdxImpl = null; - private UtilsI pixelUtilsLibGdxImpl = null; - private InternalI pixelInternalLibGdxImpl = null; + private App pixelAppLibGdxImpl = null; + private Graphics pixelGraphicsLibGdxImpl = null; + private Audio pixelAudioLibGdxImpl = null; + private Input pixelInputLibGdxImpl = null; + private Net pixelNetLibGdxImpl = null; + private Files pixelFilesLibGdxImpl = null; + private Utils pixelUtilsLibGdxImpl = null; + private Internal pixelInternalLibGdxImpl = null; @Override - public GraphicsI graphics() { + public Graphics graphics() { if (pixelGraphicsLibGdxImpl == null) { pixelGraphicsLibGdxImpl = new GraphicsLibGDXImpl(); } @@ -56,7 +54,7 @@ public class PixelBackendLibGDX implements PixelBackend { } @Override - public AudioI audio() { + public Audio audio() { if (pixelAudioLibGdxImpl == null) { pixelAudioLibGdxImpl = new AudioLibGDXImpl(); @@ -65,7 +63,7 @@ public class PixelBackendLibGDX implements PixelBackend { } @Override - public InputI input() { + public Input input() { if (pixelInputLibGdxImpl == null) { pixelInputLibGdxImpl = new InputLibGDXImpl(); @@ -74,7 +72,7 @@ public class PixelBackendLibGDX implements PixelBackend { } @Override - public NetI net() { + public Net net() { if (pixelNetLibGdxImpl == null) { pixelNetLibGdxImpl = new NetLibGDXImpl(); @@ -83,25 +81,16 @@ public class PixelBackendLibGDX implements PixelBackend { } @Override - public AssetI asset() { + public Files files() { - if (pixelAssetLibGdxImpl == null) { - pixelAssetLibGdxImpl = new AssetLibGDXImpl(); + if (pixelFilesLibGdxImpl == null) { + pixelFilesLibGdxImpl = new FilesLibGDXImpl(); } - return pixelAssetLibGdxImpl; + return pixelFilesLibGdxImpl; } @Override - public StorageI storage() { - - if (pixelStorageLibGdxImpl == null) { - pixelStorageLibGdxImpl = new StorageLibGDXImpl(); - } - return pixelStorageLibGdxImpl; - } - - @Override - public UtilsI utils() { + public Utils utils() { if (pixelUtilsLibGdxImpl == null) { pixelUtilsLibGdxImpl = new UtilsLibGDXImpl(app()); @@ -110,7 +99,7 @@ public class PixelBackendLibGDX implements PixelBackend { } @Override - public AppI app() { + public App app() { if (pixelAppLibGdxImpl == null) { pixelAppLibGdxImpl = new AppLibGDXImpl(); } @@ -118,7 +107,7 @@ public class PixelBackendLibGDX implements PixelBackend { } @Override - public InternalI internal() { + public Internal internal() { if (pixelInternalLibGdxImpl == null) { pixelInternalLibGdxImpl = new InternalLibGDXImpl(); diff --git a/src/main/java/com/pixelgamelibrary/backend/libgdx/StorageLibGDXImpl.java b/src/main/java/com/pixelgamelibrary/backend/libgdx/StorageLibGDXImpl.java deleted file mode 100644 index 349dd7d..0000000 --- a/src/main/java/com/pixelgamelibrary/backend/libgdx/StorageLibGDXImpl.java +++ /dev/null @@ -1,39 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////////////////////// -// Pixel: Game library. -// Copyright (C) 2024 the original author or authors. -// -// This program is free software: you can redistribute it and/or -// modify it under the terms of the GNU General Public License -// as published by the Free Software Foundation, either version 3 -// of the License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program. If not, see -// or write to the Free Software -// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -/////////////////////////////////////////////////////////////////////////////////////////////// -package com.pixelgamelibrary.backend.libgdx; - -import com.pixelgamelibrary.api.interfaces.StorageI; -import com.pixelgamelibrary.backend.libgdx.storage.StorageFactory; -import com.pixelgamelibrary.api.storage.Storage; - -/** - * - * @author robertvokac - */ -public class StorageLibGDXImpl implements StorageI { - - @Override - public Storage getStorage() { - return StorageFactory.getStorage(); - } - - - -} diff --git a/src/main/java/com/pixelgamelibrary/backend/libgdx/UtilsLibGDXImpl.java b/src/main/java/com/pixelgamelibrary/backend/libgdx/UtilsLibGDXImpl.java index 2b24108..5a911c5 100644 --- a/src/main/java/com/pixelgamelibrary/backend/libgdx/UtilsLibGDXImpl.java +++ b/src/main/java/com/pixelgamelibrary/backend/libgdx/UtilsLibGDXImpl.java @@ -22,25 +22,27 @@ package com.pixelgamelibrary.backend.libgdx; import com.badlogic.gdx.utils.Base64Coder; import com.badlogic.gdx.utils.XmlReader; import com.pixelgamelibrary.api.interfaces.XmlElement; -import com.pixelgamelibrary.api.interfaces.UtilsI; import java.util.List; import java.util.Map; import com.badlogic.gdx.utils.compression.Lzma; import com.pixelgamelibrary.api.PixelException; -import com.pixelgamelibrary.api.interfaces.AppI; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; +import com.pixelgamelibrary.api.interfaces.Utils; +import com.pixelgamelibrary.api.interfaces.App; +import com.pixelgamelibrary.api.utils.CollectionUtils; +import com.pixelgamelibrary.api.utils.ReflectionUtils; /** * * @author robertvokac */ -public class UtilsLibGDXImpl implements UtilsI { +public class UtilsLibGDXImpl implements Utils { - private final AppI appI; + private final App appI; - public UtilsLibGDXImpl(AppI appI) { + public UtilsLibGDXImpl(App appI) { this.appI = appI; } @@ -112,4 +114,14 @@ public class UtilsLibGDXImpl implements UtilsI { return outputStream.toByteArray(); } + @Override + public ReflectionUtils reflection() { + throw new UnsupportedOperationException("Not supported yet."); // Generated from nbfs://nbhost/SystemFileSystem/Templates/Classes/Code/GeneratedMethodBody + } + + @Override + public CollectionUtils collections() { + throw new UnsupportedOperationException("Not supported yet."); // Generated from nbfs://nbhost/SystemFileSystem/Templates/Classes/Code/GeneratedMethodBody + } + } diff --git a/src/main/java/com/pixelgamelibrary/backend/libgdx/assets/AssetsLibGDXStorage.java b/src/main/java/com/pixelgamelibrary/backend/libgdx/assets/AssetsLibGDXStorage.java index fe27a1f..1e86c9e 100644 --- a/src/main/java/com/pixelgamelibrary/backend/libgdx/assets/AssetsLibGDXStorage.java +++ b/src/main/java/com/pixelgamelibrary/backend/libgdx/assets/AssetsLibGDXStorage.java @@ -6,6 +6,7 @@ import com.pixelgamelibrary.api.Platform; import com.pixelgamelibrary.api.storage.FileType; import com.pixelgamelibrary.api.storage.RegularFileType; import com.pixelgamelibrary.api.storage.Storage; +import com.pixelgamelibrary.api.storage.StorageType; import java.util.List; import java.util.stream.Collectors; import lombok.Getter; @@ -184,4 +185,39 @@ public class AssetsLibGDXStorage implements Storage { } } + @Override + public byte[] backup(String methodName) { + throw new UnsupportedOperationException("Not supported yet."); // Generated from nbfs://nbhost/SystemFileSystem/Templates/Classes/Code/GeneratedMethodBody + } + + @Override + public void restore(String methodName, byte[] data) { + throw createUnsupportedOperationException(); + } + + @Override + public boolean isReadonly() { + return true; + } + + @Override + public void clear() { + throw createUnsupportedOperationException(); + } + + @Override + public boolean isEmpty() { + throw new UnsupportedOperationException("Not supported yet."); // Generated from nbfs://nbhost/SystemFileSystem/Templates/Classes/Code/GeneratedMethodBody + } + + @Override + public long size() { + throw new UnsupportedOperationException("Not supported yet."); // Generated from nbfs://nbhost/SystemFileSystem/Templates/Classes/Code/GeneratedMethodBody + } + + @Override + public StorageType getStorageType() { + return StorageType.ASSETS; + } + } diff --git a/src/main/java/com/pixelgamelibrary/backend/libgdx/game/LibGdxGame.java b/src/main/java/com/pixelgamelibrary/backend/libgdx/game/LibGdxGame.java index 4c74593..281636b 100644 --- a/src/main/java/com/pixelgamelibrary/backend/libgdx/game/LibGdxGame.java +++ b/src/main/java/com/pixelgamelibrary/backend/libgdx/game/LibGdxGame.java @@ -19,11 +19,11 @@ /////////////////////////////////////////////////////////////////////////////////////////////// package com.pixelgamelibrary.backend.libgdx.game; -import com.pixelgamelibrary.api.GameI; import com.pixelgamelibrary.api.GameWrapper; import com.pixelgamelibrary.api.OnSetScreenListener; -import com.pixelgamelibrary.api.ScreenI; import com.pixelgamelibrary.backend.libgdx.screen.LibGdxScreen; +import com.pixelgamelibrary.api.Game; +import com.pixelgamelibrary.api.Screen; /** * @@ -31,10 +31,10 @@ import com.pixelgamelibrary.backend.libgdx.screen.LibGdxScreen; */ public class LibGdxGame extends com.badlogic.gdx.Game implements OnSetScreenListener { - private final GameI game; + private final Game game; @Override - public void onSetScreen(ScreenI screen) { + public void onSetScreen(Screen screen) { setScreen(new LibGdxScreen(screen)); System.out.println("LibGdxGame:onSetScreen"); } @@ -43,7 +43,7 @@ public class LibGdxGame extends com.badlogic.gdx.Game implements OnSetScreenList private final LibGdxGame libGdxGame; - public LibGdxGameWrapper(GameI gameI, LibGdxGame libGdxGame) { + public LibGdxGameWrapper(Game gameI, LibGdxGame libGdxGame) { super(gameI); this.libGdxGame = libGdxGame; gameI.setOnSetScreenListener(libGdxGame); @@ -65,7 +65,7 @@ public class LibGdxGame extends com.badlogic.gdx.Game implements OnSetScreenList } - public LibGdxGame(GameI game) { + public LibGdxGame(Game game) { this.game = new LibGdxGameWrapper(game, this); } diff --git a/src/main/java/com/pixelgamelibrary/backend/libgdx/screen/LibGdxScreen.java b/src/main/java/com/pixelgamelibrary/backend/libgdx/screen/LibGdxScreen.java index c70f0e3..f433606 100644 --- a/src/main/java/com/pixelgamelibrary/backend/libgdx/screen/LibGdxScreen.java +++ b/src/main/java/com/pixelgamelibrary/backend/libgdx/screen/LibGdxScreen.java @@ -19,9 +19,9 @@ /////////////////////////////////////////////////////////////////////////////////////////////// package com.pixelgamelibrary.backend.libgdx.screen; -import com.pixelgamelibrary.api.ScreenI; import com.pixelgamelibrary.api.ScreenWrapper; import lombok.Getter; +import com.pixelgamelibrary.api.Screen; /** * @@ -30,20 +30,20 @@ import lombok.Getter; public class LibGdxScreen extends com.badlogic.gdx.ScreenAdapter { @Getter - private final ScreenI pixelScreen; + private final Screen pixelScreen; class LibGdxScreenWrapper extends ScreenWrapper { private final LibGdxScreen libGdxScreen; - public LibGdxScreenWrapper(ScreenI screen, LibGdxScreen libGdxScreenIn) { + public LibGdxScreenWrapper(Screen screen, LibGdxScreen libGdxScreenIn) { super(screen); this.libGdxScreen = libGdxScreenIn; } } - public LibGdxScreen(ScreenI screen) { + public LibGdxScreen(Screen screen) { this.pixelScreen = new LibGdxScreenWrapper(screen, this); System.out.println("aaaaaa"); } diff --git a/src/main/java/com/pixelgamelibrary/backend/libgdx/storage/DesktopAndroidStorage.java b/src/main/java/com/pixelgamelibrary/backend/libgdx/storage/DesktopAndroidStorage.java index abb4020..2375414 100644 --- a/src/main/java/com/pixelgamelibrary/backend/libgdx/storage/DesktopAndroidStorage.java +++ b/src/main/java/com/pixelgamelibrary/backend/libgdx/storage/DesktopAndroidStorage.java @@ -21,10 +21,12 @@ package com.pixelgamelibrary.backend.libgdx.storage; import com.badlogic.gdx.Gdx; import com.pixelgamelibrary.api.Pixel; +import com.pixelgamelibrary.api.Platform; import com.pixelgamelibrary.api.storage.FileType; import com.pixelgamelibrary.api.storage.RegularFileType; import com.pixelgamelibrary.api.storage.Storage; import com.pixelgamelibrary.api.storage.StorageException; +import com.pixelgamelibrary.api.storage.StorageType; import java.util.Arrays; import java.util.List; import java.util.stream.Collectors; @@ -245,5 +247,40 @@ public abstract class DesktopAndroidStorage implements Storage { return isTextFile(content); } + @Override + public byte[] backup(String methodName) { + throw new UnsupportedOperationException("Not supported yet."); // Generated from nbfs://nbhost/SystemFileSystem/Templates/Classes/Code/GeneratedMethodBody + } + + @Override + public void restore(String methodName, byte[] data) { + throw new UnsupportedOperationException("Not supported yet."); // Generated from nbfs://nbhost/SystemFileSystem/Templates/Classes/Code/GeneratedMethodBody + } + + @Override + public boolean isReadonly() { + throw new UnsupportedOperationException("Not supported yet."); // Generated from nbfs://nbhost/SystemFileSystem/Templates/Classes/Code/GeneratedMethodBody + } + + @Override + public void clear() { + throw new UnsupportedOperationException("Not supported yet."); // Generated from nbfs://nbhost/SystemFileSystem/Templates/Classes/Code/GeneratedMethodBody + } + + @Override + public boolean isEmpty() { + throw new UnsupportedOperationException("Not supported yet."); // Generated from nbfs://nbhost/SystemFileSystem/Templates/Classes/Code/GeneratedMethodBody + } + + @Override + public long size() { + throw new UnsupportedOperationException("Not supported yet."); // Generated from nbfs://nbhost/SystemFileSystem/Templates/Classes/Code/GeneratedMethodBody + } + + @Override + public StorageType getStorageType() { + throw new UnsupportedOperationException("Not supported yet."); // Generated from nbfs://nbhost/SystemFileSystem/Templates/Classes/Code/GeneratedMethodBody + } + } diff --git a/src/test/java/com/pixelgamelibrary/backend/libgdx/storage/DesktopAndroidStorageTest.java b/src/test/java/com/pixelgamelibrary/backend/libgdx/storage/DesktopAndroidStorageTest.java index 195ff1b..a7bba66 100644 --- a/src/test/java/com/pixelgamelibrary/backend/libgdx/storage/DesktopAndroidStorageTest.java +++ b/src/test/java/com/pixelgamelibrary/backend/libgdx/storage/DesktopAndroidStorageTest.java @@ -2,19 +2,9 @@ package com.pixelgamelibrary.backend.libgdx.storage; import com.badlogic.gdx.Gdx; import com.badlogic.gdx.files.FileHandle; -import com.pixelgamelibrary.api.GameI; import com.pixelgamelibrary.api.Pixel; import com.pixelgamelibrary.api.Platform; -import com.pixelgamelibrary.api.interfaces.AppI; -import com.pixelgamelibrary.api.interfaces.AssetI; -import com.pixelgamelibrary.api.interfaces.AudioI; -import com.pixelgamelibrary.api.interfaces.GraphicsI; -import com.pixelgamelibrary.api.interfaces.InputI; -import com.pixelgamelibrary.api.interfaces.InternalI; -import com.pixelgamelibrary.api.interfaces.NetI; import com.pixelgamelibrary.api.interfaces.PixelBackend; -import com.pixelgamelibrary.api.interfaces.StorageI; -import com.pixelgamelibrary.api.interfaces.UtilsI; import com.pixelgamelibrary.api.storage.RegularFileType; import com.pixelgamelibrary.api.storage.StorageException; import org.junit.jupiter.api.BeforeEach; @@ -28,6 +18,19 @@ import static org.junit.jupiter.api.Assertions.*; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Disabled; import static org.mockito.Mockito.*; +import com.pixelgamelibrary.api.interfaces.Files; +import com.pixelgamelibrary.api.interfaces.Audio; +import com.pixelgamelibrary.api.interfaces.Graphics; +import com.pixelgamelibrary.api.interfaces.Input; +import com.pixelgamelibrary.api.interfaces.Internal; +import com.pixelgamelibrary.api.interfaces.Net; +import com.pixelgamelibrary.api.interfaces.Utils; +import com.pixelgamelibrary.api.interfaces.App; +import com.pixelgamelibrary.api.Game; +import com.pixelgamelibrary.api.PixelFeature; +import com.pixelgamelibrary.api.utils.ClipBoard; +import com.pixelgamelibrary.api.utils.LogLevel; +import com.pixelgamelibrary.api.utils.Preferences; class DesktopAndroidStorageTest { @@ -39,8 +42,8 @@ class DesktopAndroidStorageTest { static void setUpBeforeAll() { PixelBackend dummyPixelBackend = new PixelBackend() { @Override - public AppI app() { - return new AppI() { + public App app() { + return new App() { @Override public Platform getPlatform() { throw new UnsupportedOperationException("Not supported yet."); // Generated from nbfs://nbhost/SystemFileSystem/Templates/Classes/Code/GeneratedMethodBody @@ -86,12 +89,42 @@ class DesktopAndroidStorageTest { } @Override - public void setGame(GameI game) { + public void setGame(Game game) { throw new UnsupportedOperationException("Not supported yet."); // Generated from nbfs://nbhost/SystemFileSystem/Templates/Classes/Code/GeneratedMethodBody } @Override - public GameI getGame() { + public Game getGame() { + throw new UnsupportedOperationException("Not supported yet."); // Generated from nbfs://nbhost/SystemFileSystem/Templates/Classes/Code/GeneratedMethodBody + } + + @Override + public void setLogLevel(LogLevel logLevel) { + throw new UnsupportedOperationException("Not supported yet."); // Generated from nbfs://nbhost/SystemFileSystem/Templates/Classes/Code/GeneratedMethodBody + } + + @Override + public Preferences getPreferences(String preferencesName) { + throw new UnsupportedOperationException("Not supported yet."); // Generated from nbfs://nbhost/SystemFileSystem/Templates/Classes/Code/GeneratedMethodBody + } + + @Override + public boolean isFeatureEnabled(PixelFeature feature) { + throw new UnsupportedOperationException("Not supported yet."); // Generated from nbfs://nbhost/SystemFileSystem/Templates/Classes/Code/GeneratedMethodBody + } + + @Override + public boolean isMobileDevice() { + throw new UnsupportedOperationException("Not supported yet."); // Generated from nbfs://nbhost/SystemFileSystem/Templates/Classes/Code/GeneratedMethodBody + } + + @Override + public void postRunnable(Runnable runnable) { + throw new UnsupportedOperationException("Not supported yet."); // Generated from nbfs://nbhost/SystemFileSystem/Templates/Classes/Code/GeneratedMethodBody + } + + @Override + public ClipBoard getClipBoard() { throw new UnsupportedOperationException("Not supported yet."); // Generated from nbfs://nbhost/SystemFileSystem/Templates/Classes/Code/GeneratedMethodBody } @@ -99,42 +132,37 @@ class DesktopAndroidStorageTest { } @Override - public GraphicsI graphics() { + public Graphics graphics() { throw new UnsupportedOperationException("Not supported yet."); // Generated from nbfs://nbhost/SystemFileSystem/Templates/Classes/Code/GeneratedMethodBody } @Override - public AudioI audio() { + public Audio audio() { throw new UnsupportedOperationException("Not supported yet."); // Generated from nbfs://nbhost/SystemFileSystem/Templates/Classes/Code/GeneratedMethodBody } @Override - public InputI input() { + public Input input() { throw new UnsupportedOperationException("Not supported yet."); // Generated from nbfs://nbhost/SystemFileSystem/Templates/Classes/Code/GeneratedMethodBody } @Override - public NetI net() { + public Net net() { throw new UnsupportedOperationException("Not supported yet."); // Generated from nbfs://nbhost/SystemFileSystem/Templates/Classes/Code/GeneratedMethodBody } @Override - public AssetI asset() { + public Files files() { throw new UnsupportedOperationException("Not supported yet."); // Generated from nbfs://nbhost/SystemFileSystem/Templates/Classes/Code/GeneratedMethodBody } @Override - public StorageI storage() { + public Utils utils() { throw new UnsupportedOperationException("Not supported yet."); // Generated from nbfs://nbhost/SystemFileSystem/Templates/Classes/Code/GeneratedMethodBody } @Override - public UtilsI utils() { - throw new UnsupportedOperationException("Not supported yet."); // Generated from nbfs://nbhost/SystemFileSystem/Templates/Classes/Code/GeneratedMethodBody - } - - @Override - public InternalI internal() { + public Internal internal() { throw new UnsupportedOperationException("Not supported yet."); // Generated from nbfs://nbhost/SystemFileSystem/Templates/Classes/Code/GeneratedMethodBody } };