This commit is contained in:
Robert Vokac 2024-09-18 18:15:12 +02:00
parent 95fed4c8a8
commit 51d7579f8a
No known key found for this signature in database
GPG Key ID: C459E1E4B4A986BB
16 changed files with 320 additions and 177 deletions

View File

@ -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.WebGL;
import static com.badlogic.gdx.Application.ApplicationType.iOS; import static com.badlogic.gdx.Application.ApplicationType.iOS;
import com.badlogic.gdx.Gdx; import com.badlogic.gdx.Gdx;
import com.pixelgamelibrary.api.GameI;
import com.pixelgamelibrary.api.PixelException; import com.pixelgamelibrary.api.PixelException;
import com.pixelgamelibrary.api.Platform; 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 * @author robertvokac
*/ */
public class AppLibGDXImpl implements AppI { public class AppLibGDXImpl implements App {
private static final String DEFAULT_APP_NAME = "pixel-app"; private static final String DEFAULT_APP_NAME = "pixel-app";
private String appName = null; private String appName = null;
private GameI game; private Game game;
@Override @Override
public void exit() { public void exit() {
@ -112,13 +116,43 @@ public class AppLibGDXImpl implements AppI {
} }
@Override @Override
public void setGame(GameI game) { public void setGame(Game game) {
this.game = game; this.game = game;
} }
@Override @Override
public GameI getGame() { public Game getGame() {
return game; 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
}
} }

View File

@ -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
// <https://www.gnu.org/licenses/> 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;
}
}

View File

@ -19,13 +19,13 @@
/////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////
package com.pixelgamelibrary.backend.libgdx; package com.pixelgamelibrary.backend.libgdx;
import com.pixelgamelibrary.api.interfaces.AudioI; import com.pixelgamelibrary.api.interfaces.Audio;
/** /**
* *
* @author robertvokac * @author robertvokac
*/ */
public class AudioLibGDXImpl implements AudioI { public class AudioLibGDXImpl implements Audio {

View File

@ -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
// <https://www.gnu.org/licenses/> 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
}
}

View File

@ -23,16 +23,17 @@ import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.Graphics; import com.badlogic.gdx.Graphics;
import com.pixelgamelibrary.api.WindowMode; import com.pixelgamelibrary.api.WindowMode;
import com.pixelgamelibrary.api.PixelException; import com.pixelgamelibrary.api.PixelException;
import com.pixelgamelibrary.api.utils.Monitor;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import com.pixelgamelibrary.api.interfaces.GraphicsI; //import com.pixelgamelibrary.api.interfaces.Graphics;
/** /**
* *
* @author robertvokac * @author robertvokac
*/ */
public class GraphicsLibGDXImpl implements GraphicsI { public class GraphicsLibGDXImpl implements com.pixelgamelibrary.api.interfaces.Graphics {
@Override @Override
@ -94,4 +95,9 @@ public class GraphicsLibGDXImpl implements GraphicsI {
private Graphics.DisplayMode originalDisplayMode = null; private Graphics.DisplayMode originalDisplayMode = null;
@Override
public List<Monitor> getMonitors() {
throw new UnsupportedOperationException("Not supported yet."); // Generated from nbfs://nbhost/SystemFileSystem/Templates/Classes/Code/GeneratedMethodBody
}
} }

View File

@ -19,13 +19,13 @@
/////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////
package com.pixelgamelibrary.backend.libgdx; package com.pixelgamelibrary.backend.libgdx;
import com.pixelgamelibrary.api.interfaces.InputI; import com.pixelgamelibrary.api.interfaces.Input;
/** /**
* *
* @author robertvokac * @author robertvokac
*/ */
public class InputLibGDXImpl implements InputI { public class InputLibGDXImpl implements Input {

View File

@ -19,13 +19,13 @@
/////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////
package com.pixelgamelibrary.backend.libgdx; package com.pixelgamelibrary.backend.libgdx;
import com.pixelgamelibrary.api.interfaces.InternalI; import com.pixelgamelibrary.api.interfaces.Internal;
/** /**
* *
* @author robertvokac * @author robertvokac
*/ */
public class InternalLibGDXImpl implements InternalI { public class InternalLibGDXImpl implements Internal {

View File

@ -19,13 +19,13 @@
/////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////
package com.pixelgamelibrary.backend.libgdx; package com.pixelgamelibrary.backend.libgdx;
import com.pixelgamelibrary.api.interfaces.NetI; import com.pixelgamelibrary.api.interfaces.Net;
/** /**
* *
* @author robertvokac * @author robertvokac
*/ */
public class NetLibGDXImpl implements NetI { public class NetLibGDXImpl implements Net {

View File

@ -19,16 +19,15 @@
/////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////
package com.pixelgamelibrary.backend.libgdx; 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.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 { public class PixelBackendLibGDX implements PixelBackend {
private AppI pixelAppLibGdxImpl = null; private App pixelAppLibGdxImpl = null;
private GraphicsI pixelGraphicsLibGdxImpl = null; private Graphics pixelGraphicsLibGdxImpl = null;
private AudioI pixelAudioLibGdxImpl = null; private Audio pixelAudioLibGdxImpl = null;
private InputI pixelInputLibGdxImpl = null; private Input pixelInputLibGdxImpl = null;
private NetI pixelNetLibGdxImpl = null; private Net pixelNetLibGdxImpl = null;
private AssetI pixelAssetLibGdxImpl = null; private Files pixelFilesLibGdxImpl = null;
private StorageI pixelStorageLibGdxImpl = null; private Utils pixelUtilsLibGdxImpl = null;
private UtilsI pixelUtilsLibGdxImpl = null; private Internal pixelInternalLibGdxImpl = null;
private InternalI pixelInternalLibGdxImpl = null;
@Override @Override
public GraphicsI graphics() { public Graphics graphics() {
if (pixelGraphicsLibGdxImpl == null) { if (pixelGraphicsLibGdxImpl == null) {
pixelGraphicsLibGdxImpl = new GraphicsLibGDXImpl(); pixelGraphicsLibGdxImpl = new GraphicsLibGDXImpl();
} }
@ -56,7 +54,7 @@ public class PixelBackendLibGDX implements PixelBackend {
} }
@Override @Override
public AudioI audio() { public Audio audio() {
if (pixelAudioLibGdxImpl == null) { if (pixelAudioLibGdxImpl == null) {
pixelAudioLibGdxImpl = new AudioLibGDXImpl(); pixelAudioLibGdxImpl = new AudioLibGDXImpl();
@ -65,7 +63,7 @@ public class PixelBackendLibGDX implements PixelBackend {
} }
@Override @Override
public InputI input() { public Input input() {
if (pixelInputLibGdxImpl == null) { if (pixelInputLibGdxImpl == null) {
pixelInputLibGdxImpl = new InputLibGDXImpl(); pixelInputLibGdxImpl = new InputLibGDXImpl();
@ -74,7 +72,7 @@ public class PixelBackendLibGDX implements PixelBackend {
} }
@Override @Override
public NetI net() { public Net net() {
if (pixelNetLibGdxImpl == null) { if (pixelNetLibGdxImpl == null) {
pixelNetLibGdxImpl = new NetLibGDXImpl(); pixelNetLibGdxImpl = new NetLibGDXImpl();
@ -83,25 +81,16 @@ public class PixelBackendLibGDX implements PixelBackend {
} }
@Override @Override
public AssetI asset() { public Files files() {
if (pixelAssetLibGdxImpl == null) { if (pixelFilesLibGdxImpl == null) {
pixelAssetLibGdxImpl = new AssetLibGDXImpl(); pixelFilesLibGdxImpl = new FilesLibGDXImpl();
} }
return pixelAssetLibGdxImpl; return pixelFilesLibGdxImpl;
} }
@Override @Override
public StorageI storage() { public Utils utils() {
if (pixelStorageLibGdxImpl == null) {
pixelStorageLibGdxImpl = new StorageLibGDXImpl();
}
return pixelStorageLibGdxImpl;
}
@Override
public UtilsI utils() {
if (pixelUtilsLibGdxImpl == null) { if (pixelUtilsLibGdxImpl == null) {
pixelUtilsLibGdxImpl = new UtilsLibGDXImpl(app()); pixelUtilsLibGdxImpl = new UtilsLibGDXImpl(app());
@ -110,7 +99,7 @@ public class PixelBackendLibGDX implements PixelBackend {
} }
@Override @Override
public AppI app() { public App app() {
if (pixelAppLibGdxImpl == null) { if (pixelAppLibGdxImpl == null) {
pixelAppLibGdxImpl = new AppLibGDXImpl(); pixelAppLibGdxImpl = new AppLibGDXImpl();
} }
@ -118,7 +107,7 @@ public class PixelBackendLibGDX implements PixelBackend {
} }
@Override @Override
public InternalI internal() { public Internal internal() {
if (pixelInternalLibGdxImpl == null) { if (pixelInternalLibGdxImpl == null) {
pixelInternalLibGdxImpl = new InternalLibGDXImpl(); pixelInternalLibGdxImpl = new InternalLibGDXImpl();

View File

@ -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
// <https://www.gnu.org/licenses/> 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();
}
}

View File

@ -22,25 +22,27 @@ package com.pixelgamelibrary.backend.libgdx;
import com.badlogic.gdx.utils.Base64Coder; import com.badlogic.gdx.utils.Base64Coder;
import com.badlogic.gdx.utils.XmlReader; import com.badlogic.gdx.utils.XmlReader;
import com.pixelgamelibrary.api.interfaces.XmlElement; import com.pixelgamelibrary.api.interfaces.XmlElement;
import com.pixelgamelibrary.api.interfaces.UtilsI;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import com.badlogic.gdx.utils.compression.Lzma; import com.badlogic.gdx.utils.compression.Lzma;
import com.pixelgamelibrary.api.PixelException; import com.pixelgamelibrary.api.PixelException;
import com.pixelgamelibrary.api.interfaces.AppI;
import java.io.ByteArrayInputStream; import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream; import java.io.ByteArrayOutputStream;
import java.io.IOException; 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 * @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; this.appI = appI;
} }
@ -112,4 +114,14 @@ public class UtilsLibGDXImpl implements UtilsI {
return outputStream.toByteArray(); 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
}
} }

View File

@ -6,6 +6,7 @@ import com.pixelgamelibrary.api.Platform;
import com.pixelgamelibrary.api.storage.FileType; import com.pixelgamelibrary.api.storage.FileType;
import com.pixelgamelibrary.api.storage.RegularFileType; import com.pixelgamelibrary.api.storage.RegularFileType;
import com.pixelgamelibrary.api.storage.Storage; import com.pixelgamelibrary.api.storage.Storage;
import com.pixelgamelibrary.api.storage.StorageType;
import java.util.List; import java.util.List;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import lombok.Getter; 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;
}
} }

View File

@ -19,11 +19,11 @@
/////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////
package com.pixelgamelibrary.backend.libgdx.game; package com.pixelgamelibrary.backend.libgdx.game;
import com.pixelgamelibrary.api.GameI;
import com.pixelgamelibrary.api.GameWrapper; import com.pixelgamelibrary.api.GameWrapper;
import com.pixelgamelibrary.api.OnSetScreenListener; import com.pixelgamelibrary.api.OnSetScreenListener;
import com.pixelgamelibrary.api.ScreenI;
import com.pixelgamelibrary.backend.libgdx.screen.LibGdxScreen; 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 { public class LibGdxGame extends com.badlogic.gdx.Game implements OnSetScreenListener {
private final GameI game; private final Game game;
@Override @Override
public void onSetScreen(ScreenI screen) { public void onSetScreen(Screen screen) {
setScreen(new LibGdxScreen(screen)); setScreen(new LibGdxScreen(screen));
System.out.println("LibGdxGame:onSetScreen"); System.out.println("LibGdxGame:onSetScreen");
} }
@ -43,7 +43,7 @@ public class LibGdxGame extends com.badlogic.gdx.Game implements OnSetScreenList
private final LibGdxGame libGdxGame; private final LibGdxGame libGdxGame;
public LibGdxGameWrapper(GameI gameI, LibGdxGame libGdxGame) { public LibGdxGameWrapper(Game gameI, LibGdxGame libGdxGame) {
super(gameI); super(gameI);
this.libGdxGame = libGdxGame; this.libGdxGame = libGdxGame;
gameI.setOnSetScreenListener(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); this.game = new LibGdxGameWrapper(game, this);
} }

View File

@ -19,9 +19,9 @@
/////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////
package com.pixelgamelibrary.backend.libgdx.screen; package com.pixelgamelibrary.backend.libgdx.screen;
import com.pixelgamelibrary.api.ScreenI;
import com.pixelgamelibrary.api.ScreenWrapper; import com.pixelgamelibrary.api.ScreenWrapper;
import lombok.Getter; import lombok.Getter;
import com.pixelgamelibrary.api.Screen;
/** /**
* *
@ -30,20 +30,20 @@ import lombok.Getter;
public class LibGdxScreen extends com.badlogic.gdx.ScreenAdapter { public class LibGdxScreen extends com.badlogic.gdx.ScreenAdapter {
@Getter @Getter
private final ScreenI pixelScreen; private final Screen pixelScreen;
class LibGdxScreenWrapper extends ScreenWrapper { class LibGdxScreenWrapper extends ScreenWrapper {
private final LibGdxScreen libGdxScreen; private final LibGdxScreen libGdxScreen;
public LibGdxScreenWrapper(ScreenI screen, LibGdxScreen libGdxScreenIn) { public LibGdxScreenWrapper(Screen screen, LibGdxScreen libGdxScreenIn) {
super(screen); super(screen);
this.libGdxScreen = libGdxScreenIn; this.libGdxScreen = libGdxScreenIn;
} }
} }
public LibGdxScreen(ScreenI screen) { public LibGdxScreen(Screen screen) {
this.pixelScreen = new LibGdxScreenWrapper(screen, this); this.pixelScreen = new LibGdxScreenWrapper(screen, this);
System.out.println("aaaaaa"); System.out.println("aaaaaa");
} }

View File

@ -21,10 +21,12 @@ package com.pixelgamelibrary.backend.libgdx.storage;
import com.badlogic.gdx.Gdx; import com.badlogic.gdx.Gdx;
import com.pixelgamelibrary.api.Pixel; import com.pixelgamelibrary.api.Pixel;
import com.pixelgamelibrary.api.Platform;
import com.pixelgamelibrary.api.storage.FileType; import com.pixelgamelibrary.api.storage.FileType;
import com.pixelgamelibrary.api.storage.RegularFileType; import com.pixelgamelibrary.api.storage.RegularFileType;
import com.pixelgamelibrary.api.storage.Storage; import com.pixelgamelibrary.api.storage.Storage;
import com.pixelgamelibrary.api.storage.StorageException; import com.pixelgamelibrary.api.storage.StorageException;
import com.pixelgamelibrary.api.storage.StorageType;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@ -245,5 +247,40 @@ public abstract class DesktopAndroidStorage implements Storage {
return isTextFile(content); 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
}
} }

View File

@ -2,19 +2,9 @@ package com.pixelgamelibrary.backend.libgdx.storage;
import com.badlogic.gdx.Gdx; import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.files.FileHandle; import com.badlogic.gdx.files.FileHandle;
import com.pixelgamelibrary.api.GameI;
import com.pixelgamelibrary.api.Pixel; import com.pixelgamelibrary.api.Pixel;
import com.pixelgamelibrary.api.Platform; 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.PixelBackend;
import com.pixelgamelibrary.api.interfaces.StorageI;
import com.pixelgamelibrary.api.interfaces.UtilsI;
import com.pixelgamelibrary.api.storage.RegularFileType; import com.pixelgamelibrary.api.storage.RegularFileType;
import com.pixelgamelibrary.api.storage.StorageException; import com.pixelgamelibrary.api.storage.StorageException;
import org.junit.jupiter.api.BeforeEach; 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.BeforeAll;
import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Disabled;
import static org.mockito.Mockito.*; 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 { class DesktopAndroidStorageTest {
@ -39,8 +42,8 @@ class DesktopAndroidStorageTest {
static void setUpBeforeAll() { static void setUpBeforeAll() {
PixelBackend dummyPixelBackend = new PixelBackend() { PixelBackend dummyPixelBackend = new PixelBackend() {
@Override @Override
public AppI app() { public App app() {
return new AppI() { return new App() {
@Override @Override
public Platform getPlatform() { public Platform getPlatform() {
throw new UnsupportedOperationException("Not supported yet."); // Generated from nbfs://nbhost/SystemFileSystem/Templates/Classes/Code/GeneratedMethodBody throw new UnsupportedOperationException("Not supported yet."); // Generated from nbfs://nbhost/SystemFileSystem/Templates/Classes/Code/GeneratedMethodBody
@ -86,12 +89,42 @@ class DesktopAndroidStorageTest {
} }
@Override @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 throw new UnsupportedOperationException("Not supported yet."); // Generated from nbfs://nbhost/SystemFileSystem/Templates/Classes/Code/GeneratedMethodBody
} }
@Override @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 throw new UnsupportedOperationException("Not supported yet."); // Generated from nbfs://nbhost/SystemFileSystem/Templates/Classes/Code/GeneratedMethodBody
} }
@ -99,42 +132,37 @@ class DesktopAndroidStorageTest {
} }
@Override @Override
public GraphicsI graphics() { public Graphics graphics() {
throw new UnsupportedOperationException("Not supported yet."); // Generated from nbfs://nbhost/SystemFileSystem/Templates/Classes/Code/GeneratedMethodBody throw new UnsupportedOperationException("Not supported yet."); // Generated from nbfs://nbhost/SystemFileSystem/Templates/Classes/Code/GeneratedMethodBody
} }
@Override @Override
public AudioI audio() { public Audio audio() {
throw new UnsupportedOperationException("Not supported yet."); // Generated from nbfs://nbhost/SystemFileSystem/Templates/Classes/Code/GeneratedMethodBody throw new UnsupportedOperationException("Not supported yet."); // Generated from nbfs://nbhost/SystemFileSystem/Templates/Classes/Code/GeneratedMethodBody
} }
@Override @Override
public InputI input() { public Input input() {
throw new UnsupportedOperationException("Not supported yet."); // Generated from nbfs://nbhost/SystemFileSystem/Templates/Classes/Code/GeneratedMethodBody throw new UnsupportedOperationException("Not supported yet."); // Generated from nbfs://nbhost/SystemFileSystem/Templates/Classes/Code/GeneratedMethodBody
} }
@Override @Override
public NetI net() { public Net net() {
throw new UnsupportedOperationException("Not supported yet."); // Generated from nbfs://nbhost/SystemFileSystem/Templates/Classes/Code/GeneratedMethodBody throw new UnsupportedOperationException("Not supported yet."); // Generated from nbfs://nbhost/SystemFileSystem/Templates/Classes/Code/GeneratedMethodBody
} }
@Override @Override
public AssetI asset() { public Files files() {
throw new UnsupportedOperationException("Not supported yet."); // Generated from nbfs://nbhost/SystemFileSystem/Templates/Classes/Code/GeneratedMethodBody throw new UnsupportedOperationException("Not supported yet."); // Generated from nbfs://nbhost/SystemFileSystem/Templates/Classes/Code/GeneratedMethodBody
} }
@Override @Override
public StorageI storage() { public Utils utils() {
throw new UnsupportedOperationException("Not supported yet."); // Generated from nbfs://nbhost/SystemFileSystem/Templates/Classes/Code/GeneratedMethodBody throw new UnsupportedOperationException("Not supported yet."); // Generated from nbfs://nbhost/SystemFileSystem/Templates/Classes/Code/GeneratedMethodBody
} }
@Override @Override
public UtilsI utils() { public Internal internal() {
throw new UnsupportedOperationException("Not supported yet."); // Generated from nbfs://nbhost/SystemFileSystem/Templates/Classes/Code/GeneratedMethodBody
}
@Override
public InternalI internal() {
throw new UnsupportedOperationException("Not supported yet."); // Generated from nbfs://nbhost/SystemFileSystem/Templates/Classes/Code/GeneratedMethodBody throw new UnsupportedOperationException("Not supported yet."); // Generated from nbfs://nbhost/SystemFileSystem/Templates/Classes/Code/GeneratedMethodBody
} }
}; };