diff --git a/.gitignore b/.gitignore index fba9eae..36f8fb3 100644 --- a/.gitignore +++ b/.gitignore @@ -4,8 +4,6 @@ gradle-app.setting /build/ /android/build/ /core/build/ -/pixel/build/ -/pixel-backend-libgdx/build/ /lwjgl2/build/ /lwjgl3/build/ /html/build/ diff --git a/android/build.gradle b/android/build.gradle index 7aeaf73..84ae67e 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -58,8 +58,7 @@ dependencies { implementation "com.github.MrStahlfelge.gdx-websockets:common:$websocketVersion" implementation project(':core') implementation "com.pixelgamelibrary:pixel:$pixelVersion" - implementation project(':pixel-backend-libgdx') - //implementation "com.openeggbert.gdx:gdx-storage:0.0.0-SNAPSHOT" + implementation "com.pixelgamelibrary:pixel-backend-libgdx:$pixelVersion" natives "com.badlogicgames.gdx:gdx-box2d-platform:$gdxVersion:natives-arm64-v8a" natives "com.badlogicgames.gdx:gdx-box2d-platform:$gdxVersion:natives-armeabi-v7a" diff --git a/android/src/main/java/com/openeggbert/android/AndroidLauncher.java b/android/src/main/java/com/openeggbert/android/AndroidLauncher.java index 9e3d191..f4f3fff 100644 --- a/android/src/main/java/com/openeggbert/android/AndroidLauncher.java +++ b/android/src/main/java/com/openeggbert/android/AndroidLauncher.java @@ -5,8 +5,8 @@ import android.os.Bundle; import com.badlogic.gdx.backends.android.AndroidApplication; import com.badlogic.gdx.backends.android.AndroidApplicationConfiguration; import com.openeggbert.core.main.OpenEggbertGame; -import com.pixelgamelibrary.Pixel; -import com.pixelgamelibrary.backend.libgdx.PixelLibGDXBackend; +import com.pixelgamelibrary.api.Pixel; +import com.pixelgamelibrary.backend.libgdx.PixelBackendLibGDX; /** Launches the Android application. */ public class AndroidLauncher extends AndroidApplication { @@ -15,7 +15,7 @@ public class AndroidLauncher extends AndroidApplication { super.onCreate(savedInstanceState); AndroidApplicationConfiguration configuration = new AndroidApplicationConfiguration(); configuration.useImmersiveMode = true; // Recommended, but not required. - Pixel.initBackend(new PixelLibGDXBackend()); + Pixel.initBackend(new PixelBackendLibGDX()); initialize(new OpenEggbertGame(), configuration); } } \ No newline at end of file diff --git a/build.gradle b/build.gradle index 25a3720..8f9b246 100644 --- a/build.gradle +++ b/build.gradle @@ -61,9 +61,7 @@ configure(subprojects - project(':android')) { subprojects { version = '0.0.0-SNAPSHOT' ext.appName = 'open-eggbert' - if (project.name == 'pixel-backend-libgdx') { - ext.appName = 'pixel-backend-libgdx' - } + repositories { mavenCentral() maven { url 'https://s01.oss.sonatype.org' } diff --git a/core/src/main/java/com/openeggbert/core/configuration/OpenEggbertDisplayMode.java b/core/src/main/java/com/openeggbert/core/configuration/OpenEggbertDisplayMode.java index 79e5e26..88107d5 100644 --- a/core/src/main/java/com/openeggbert/core/configuration/OpenEggbertDisplayMode.java +++ b/core/src/main/java/com/openeggbert/core/configuration/OpenEggbertDisplayMode.java @@ -19,7 +19,7 @@ /////////////////////////////////////////////////////////////////////////////////////////////// package com.openeggbert.core.configuration; -import com.pixelgamelibrary.Pixel; +import com.pixelgamelibrary.api.Pixel; import com.openeggbert.core.main.OpenEggbertException; /** diff --git a/core/src/main/java/com/openeggbert/core/main/OpenEggbertGame.java b/core/src/main/java/com/openeggbert/core/main/OpenEggbertGame.java index 2cf303e..31f8635 100644 --- a/core/src/main/java/com/openeggbert/core/main/OpenEggbertGame.java +++ b/core/src/main/java/com/openeggbert/core/main/OpenEggbertGame.java @@ -36,11 +36,11 @@ import com.openeggbert.core.mod.Mod; import com.openeggbert.core.mod.ModIdentification; import com.openeggbert.core.screen.GameSpaceListScreen; import com.openeggbert.core.screen.InitScreen; -import com.pixelgamelibrary.storage.Storage; +import com.pixelgamelibrary.api.storage.Storage; import com.openeggbert.core.configuration.OpenEggbertDisplayMode; -import com.pixelgamelibrary.Game; +import com.pixelgamelibrary.api.Game; import com.openeggbert.core.utils.OpenEggbertUtils; -import com.pixelgamelibrary.Pixel; +import com.pixelgamelibrary.api.Pixel; import java.util.ArrayList; import java.util.List; import java.util.Optional; diff --git a/core/src/main/java/com/openeggbert/core/mod/Mod.java b/core/src/main/java/com/openeggbert/core/mod/Mod.java index 8ef7bc4..900d1ee 100644 --- a/core/src/main/java/com/openeggbert/core/mod/Mod.java +++ b/core/src/main/java/com/openeggbert/core/mod/Mod.java @@ -19,8 +19,8 @@ /////////////////////////////////////////////////////////////////////////////////////////////// package com.openeggbert.core.mod; -import com.pixelgamelibrary.api.XmlElement; -import com.pixelgamelibrary.Pixel; +import com.pixelgamelibrary.api.interfaces.XmlElement; +import com.pixelgamelibrary.api.Pixel; import com.openeggbert.core.release.Release; import java.util.ArrayList; import java.util.List; diff --git a/core/src/main/java/com/openeggbert/core/mod/ModIdentification.java b/core/src/main/java/com/openeggbert/core/mod/ModIdentification.java index 1c78bd0..7f9b395 100644 --- a/core/src/main/java/com/openeggbert/core/mod/ModIdentification.java +++ b/core/src/main/java/com/openeggbert/core/mod/ModIdentification.java @@ -19,7 +19,7 @@ /////////////////////////////////////////////////////////////////////////////////////////////// package com.openeggbert.core.mod; -import com.pixelgamelibrary.api.XmlElement; +import com.pixelgamelibrary.api.interfaces.XmlElement; import lombok.AllArgsConstructor; import lombok.Data; diff --git a/core/src/main/java/com/openeggbert/core/mod/Store.java b/core/src/main/java/com/openeggbert/core/mod/Store.java index 2ddf1a1..8b4631a 100644 --- a/core/src/main/java/com/openeggbert/core/mod/Store.java +++ b/core/src/main/java/com/openeggbert/core/mod/Store.java @@ -19,7 +19,7 @@ /////////////////////////////////////////////////////////////////////////////////////////////// package com.openeggbert.core.mod; -import com.pixelgamelibrary.api.XmlElement; +import com.pixelgamelibrary.api.interfaces.XmlElement; /** * diff --git a/core/src/main/java/com/openeggbert/core/screen/AbstractOpenEggbertScreen.java b/core/src/main/java/com/openeggbert/core/screen/AbstractOpenEggbertScreen.java index f4edc1e..c5c4eaf 100644 --- a/core/src/main/java/com/openeggbert/core/screen/AbstractOpenEggbertScreen.java +++ b/core/src/main/java/com/openeggbert/core/screen/AbstractOpenEggbertScreen.java @@ -25,7 +25,7 @@ import com.badlogic.gdx.Gdx; import com.badlogic.gdx.files.FileHandle; import com.badlogic.gdx.graphics.Texture; import com.badlogic.gdx.graphics.g2d.SpriteBatch; -import com.pixelgamelibrary.Screen; +import com.pixelgamelibrary.api.Screen; import com.openeggbert.core.gamespace.GameFileType; import com.openeggbert.core.main.OpenEggbertGame; import com.openeggbert.core.utils.OpenEggbertUtils; diff --git a/core/src/main/java/com/openeggbert/core/utils/EmbeddedFileHandleFactory.java b/core/src/main/java/com/openeggbert/core/utils/EmbeddedFileHandleFactory.java index f82376a..fc4953c 100644 --- a/core/src/main/java/com/openeggbert/core/utils/EmbeddedFileHandleFactory.java +++ b/core/src/main/java/com/openeggbert/core/utils/EmbeddedFileHandleFactory.java @@ -21,8 +21,8 @@ package com.openeggbert.core.utils; import com.badlogic.gdx.Gdx; import com.badlogic.gdx.files.FileHandle; -import com.pixelgamelibrary.Pixel; -import com.pixelgamelibrary.Platform; +import com.pixelgamelibrary.api.Pixel; +import com.pixelgamelibrary.api.Platform; /** * diff --git a/html/build.gradle b/html/build.gradle index bac3220..412fd26 100644 --- a/html/build.gradle +++ b/html/build.gradle @@ -50,7 +50,8 @@ dependencies { implementation project(':core') implementation "com.pixelgamelibrary:pixel:$pixelVersion:sources" - implementation project(':pixel-backend-libgdx') + api "com.pixelgamelibrary:pixel-backend-libgdx:$pixelVersion" + implementation "com.pixelgamelibrary:pixel-backend-libgdx:$pixelVersion:sources" implementation("com.badlogicgames.gdx-controllers:gdx-controllers-gwt:$gdxControllersVersion:sources"){exclude group: "com.badlogicgames.gdx", module: "gdx-backend-gwt"} implementation("com.badlogicgames.gdx:gdx-box2d-gwt:$gdxVersion:sources") {exclude group: "com.google.gwt", module: "gwt-user"} implementation("com.github.crykn.guacamole:gdx-gwt:$guacamoleVersion:sources"){exclude group: "com.badlogicgames.gdx", module: "gdx-backend-gwt"} @@ -149,7 +150,6 @@ task dist(dependsOn: [clean, compileGwt]) { task addSource { doLast { sourceSets.main.compileClasspath += files(project(':core').sourceSets.main.allJava.srcDirs) - sourceSets.main.compileClasspath += files(project(':pixel-backend-libgdx').sourceSets.main.allJava.srcDirs) sourceSets.main.compileClasspath += files("../core/build/generated/sources/annotationProcessor/java/main") } diff --git a/html/src/main/java/com/openeggbert/GdxDefinition.gwt.xml b/html/src/main/java/com/openeggbert/GdxDefinition.gwt.xml index 843af01..5e0f193 100644 --- a/html/src/main/java/com/openeggbert/GdxDefinition.gwt.xml +++ b/html/src/main/java/com/openeggbert/GdxDefinition.gwt.xml @@ -23,8 +23,8 @@ - - + + diff --git a/html/src/main/java/com/openeggbert/gwt/GwtLauncher.java b/html/src/main/java/com/openeggbert/gwt/GwtLauncher.java index 4470c54..2e23422 100644 --- a/html/src/main/java/com/openeggbert/gwt/GwtLauncher.java +++ b/html/src/main/java/com/openeggbert/gwt/GwtLauncher.java @@ -6,8 +6,8 @@ import com.badlogic.gdx.backends.gwt.GwtApplicationConfiguration; import com.openeggbert.core.configuration.ScreenResolution; import com.openeggbert.core.main.OpenEggbertGame; import com.badlogic.gdx.ai.GdxLogger; -import com.pixelgamelibrary.Pixel; -import com.pixelgamelibrary.backend.libgdx.PixelLibGDXBackend; +import com.pixelgamelibrary.api.Pixel; +import com.pixelgamelibrary.backend.libgdx.PixelBackendLibGDX; /** Launches the GWT application. */ public class GwtLauncher extends GwtApplication { @@ -20,7 +20,7 @@ public class GwtLauncher extends GwtApplication { //return cfg; // If you want a fixed size application, comment out the above resizable section, // and uncomment below: - Pixel.initBackend(new PixelLibGDXBackend()); + Pixel.initBackend(new PixelBackendLibGDX()); return new GwtApplicationConfiguration(ScreenResolution.VGA.getWidth(), ScreenResolution.VGA.getHeight()); } diff --git a/lwjgl3/build.gradle b/lwjgl3/build.gradle index 4196a41..616e861 100644 --- a/lwjgl3/build.gradle +++ b/lwjgl3/build.gradle @@ -34,7 +34,7 @@ dependencies { implementation project(':core') implementation "com.pixelgamelibrary:pixel:$pixelVersion" - implementation project(':pixel-backend-libgdx') + implementation "com.pixelgamelibrary:pixel-backend-libgdx:$pixelVersion" } def jarName = "${appName}-${version}.jar" diff --git a/lwjgl3/src/main/java/com/openeggbert/lwjgl3/Lwjgl3Launcher.java b/lwjgl3/src/main/java/com/openeggbert/lwjgl3/Lwjgl3Launcher.java index 2c12df3..62675e7 100644 --- a/lwjgl3/src/main/java/com/openeggbert/lwjgl3/Lwjgl3Launcher.java +++ b/lwjgl3/src/main/java/com/openeggbert/lwjgl3/Lwjgl3Launcher.java @@ -25,14 +25,14 @@ import com.badlogic.gdx.backends.lwjgl3.Lwjgl3ApplicationConfiguration; import com.openeggbert.core.configuration.ScreenResolution; import com.openeggbert.core.main.OpenEggbertGame; import com.openeggbert.core.gamespace.GameSpace; -import com.pixelgamelibrary.Pixel; -import com.pixelgamelibrary.backend.libgdx.PixelLibGDXBackend; +import com.pixelgamelibrary.api.Pixel; +import com.pixelgamelibrary.backend.libgdx.PixelBackendLibGDX; import java.util.Optional; /** Launches the desktop (LWJGL3) application. */ public class Lwjgl3Launcher { public static void main(String[] args) { - Pixel.initBackend(new PixelLibGDXBackend()); + Pixel.initBackend(new PixelBackendLibGDX()); if (StartupHelper.startNewJvmIfRequired()) return; // This handles macOS support and helps on Windows. createApplication(); } diff --git a/lwjgl3/src/main/java/com/openeggbert/lwjgl3/debugging/DesktopCommandLineScanner.java b/lwjgl3/src/main/java/com/openeggbert/lwjgl3/debugging/DesktopCommandLineScanner.java index dcdee66..37bcec0 100644 --- a/lwjgl3/src/main/java/com/openeggbert/lwjgl3/debugging/DesktopCommandLineScanner.java +++ b/lwjgl3/src/main/java/com/openeggbert/lwjgl3/debugging/DesktopCommandLineScanner.java @@ -19,7 +19,7 @@ /////////////////////////////////////////////////////////////////////////////////////////////// package com.openeggbert.lwjgl3.debugging; -import com.pixelgamelibrary.storage.command.CommandLineScanner; +import com.pixelgamelibrary.api.storage.command.CommandLineScanner; import java.util.Scanner; /** diff --git a/lwjgl3/src/main/java/com/openeggbert/lwjgl3/debugging/DesktopStorageCommandLineScanner.java b/lwjgl3/src/main/java/com/openeggbert/lwjgl3/debugging/DesktopStorageCommandLineScanner.java index 150ddcc..c7fbc51 100644 --- a/lwjgl3/src/main/java/com/openeggbert/lwjgl3/debugging/DesktopStorageCommandLineScanner.java +++ b/lwjgl3/src/main/java/com/openeggbert/lwjgl3/debugging/DesktopStorageCommandLineScanner.java @@ -19,9 +19,9 @@ /////////////////////////////////////////////////////////////////////////////////////////////// package com.openeggbert.lwjgl3.debugging; -import com.pixelgamelibrary.storage.command.StorageCommandLine; -import com.pixelgamelibrary.storage.command.StorageCommandLineScanner; -import com.pixelgamelibrary.storage.map.MemoryStorage; +import com.pixelgamelibrary.api.storage.command.StorageCommandLine; +import com.pixelgamelibrary.api.storage.command.StorageCommandLineScanner; +import com.pixelgamelibrary.api.storage.map.MemoryStorage; /** * diff --git a/pixel-backend-libgdx/build.gradle b/pixel-backend-libgdx/build.gradle deleted file mode 100644 index 034dc70..0000000 --- a/pixel-backend-libgdx/build.gradle +++ /dev/null @@ -1,32 +0,0 @@ -[compileJava, compileTestJava]*.options*.encoding = 'UTF-8' -//eclipse.project.name = appName + '-core' -eclipse.project.name = 'pixel-backend-libgdx' - -sourceSets.test.java.srcDirs = [ "src/test/java/" ] - -dependencies { - api "com.badlogicgames.gdx-controllers:gdx-controllers-core:$gdxControllersVersion" - api "com.badlogicgames.gdx:gdx-ai:$aiVersion" - api "com.badlogicgames.gdx:gdx-box2d:$gdxVersion" - api "com.badlogicgames.gdx:gdx:$gdxVersion" - api "com.github.MrStahlfelge.gdx-websockets:core:$websocketVersion" - api "com.github.MrStahlfelge.gdx-websockets:serialization:$websocketSerializationVersion" - api "com.github.crykn.guacamole:core:$guacamoleVersion" - api "com.github.crykn.guacamole:gdx:$guacamoleVersion" - api "com.github.tommyettinger:formic:$formicVersion" - api "com.github.tommyettinger:libgdx-utils-box2d:$utilsBox2dVersion" - api "com.github.tommyettinger:libgdx-utils:$utilsVersion" - api "de.golfgl.gdxcontrollerutils:gdx-controllerutils-mapping:$controllerMappingVersion" - api "games.rednblack.miniaudio:miniaudio:$miniaudioVersion" - //api "com.openeggbert.gdx:gdx-storage:0.0.0-SNAPSHOT" - annotationProcessor "org.projectlombok:lombok:$lombokVersion" - compileOnly "org.projectlombok:lombok:$lombokVersion" - testImplementation "org.junit.jupiter:junit-jupiter-api:5.10.3" - testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:5.10.3" - implementation "com.pixelgamelibrary:pixel:$pixelVersion" -} - -test { - useJUnitPlatform { - } -} diff --git a/pixel-backend-libgdx/src/main/java/com/pixelgamelibrary/backend/libgdx/AppLibGDXImpl.java b/pixel-backend-libgdx/src/main/java/com/pixelgamelibrary/backend/libgdx/AppLibGDXImpl.java deleted file mode 100644 index 526b3ea..0000000 --- a/pixel-backend-libgdx/src/main/java/com/pixelgamelibrary/backend/libgdx/AppLibGDXImpl.java +++ /dev/null @@ -1,82 +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.badlogic.gdx.Application; -import static com.badlogic.gdx.Application.ApplicationType.Android; -import static com.badlogic.gdx.Application.ApplicationType.Desktop; -import static com.badlogic.gdx.Application.ApplicationType.WebGL; -import com.badlogic.gdx.Gdx; -import com.pixelgamelibrary.PixelException; -import com.pixelgamelibrary.Platform; -import com.pixelgamelibrary.api.AppI; - -/** - * - * @author robertvokac - */ -public class AppLibGDXImpl implements AppI { - - - @Override - public void exit() { - throw new UnsupportedOperationException("Not supported yet."); // Generated from nbfs://nbhost/SystemFileSystem/Templates/Classes/Code/GeneratedMethodBody - } - - @Override - public Platform getPlatform() { - Application.ApplicationType applicationType = Gdx.app.getType(); - switch (applicationType) { - case Desktop: - return Platform.DESKTOP; - case Android: - return Platform.ANDROID; - case WebGL: - return Platform.WEB; - default: - throw new PixelException("Unsupported platform: " + applicationType); - } - } - @Override - public void log(String msg) { - Application app = Gdx.app; - if (app != null) { - Gdx.app.log(getClass().getName(), msg); - } - } - - @Override - public void error(String msg) { - - Application app = Gdx.app; - if (app != null) { - Gdx.app.error(getClass().getName(), msg); - } - } - - @Override - public void debug(String msg) { - Application app = Gdx.app; - if (app != null) { - Gdx.app.debug(getClass().getName(), msg); - } - } - -} diff --git a/pixel-backend-libgdx/src/main/java/com/pixelgamelibrary/backend/libgdx/AssetLibGDXImpl.java b/pixel-backend-libgdx/src/main/java/com/pixelgamelibrary/backend/libgdx/AssetLibGDXImpl.java deleted file mode 100644 index 25c9290..0000000 --- a/pixel-backend-libgdx/src/main/java/com/pixelgamelibrary/backend/libgdx/AssetLibGDXImpl.java +++ /dev/null @@ -1,32 +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.AssetI; - -/** - * - * @author robertvokac - */ -public class AssetLibGDXImpl implements AssetI { - - - -} diff --git a/pixel-backend-libgdx/src/main/java/com/pixelgamelibrary/backend/libgdx/AudioLibGDXImpl.java b/pixel-backend-libgdx/src/main/java/com/pixelgamelibrary/backend/libgdx/AudioLibGDXImpl.java deleted file mode 100644 index 18149a3..0000000 --- a/pixel-backend-libgdx/src/main/java/com/pixelgamelibrary/backend/libgdx/AudioLibGDXImpl.java +++ /dev/null @@ -1,32 +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.AudioI; - -/** - * - * @author robertvokac - */ -public class AudioLibGDXImpl implements AudioI { - - - -} diff --git a/pixel-backend-libgdx/src/main/java/com/pixelgamelibrary/backend/libgdx/ElementLibGDXImpl.java b/pixel-backend-libgdx/src/main/java/com/pixelgamelibrary/backend/libgdx/ElementLibGDXImpl.java deleted file mode 100644 index 953bdea..0000000 --- a/pixel-backend-libgdx/src/main/java/com/pixelgamelibrary/backend/libgdx/ElementLibGDXImpl.java +++ /dev/null @@ -1,62 +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.badlogic.gdx.utils.XmlReader; -import com.pixelgamelibrary.api.XmlElement; - -/** - * - * @author robertvokac - */ -public class ElementLibGDXImpl implements XmlElement { - - private final XmlReader.Element element; - - public ElementLibGDXImpl(com.badlogic.gdx.utils.XmlReader.Element element) { - this.element = element; - } - - @Override - public XmlElement getChildByName(String name) { - XmlReader.Element child = element.getChildByName(name); - return child == null ? null : new ElementLibGDXImpl(child); - } - - @Override - public String get(String elementName) { - return element.get(elementName); - } - - @Override - public int getChildCount() { - return element.getChildCount(); - } - - @Override - public XmlElement getChild(int i) { - XmlReader.Element child = element.getChild(i); - return child == null ? null : new ElementLibGDXImpl(child); } - - @Override - public String getText() { - return element.getText(); - } -} diff --git a/pixel-backend-libgdx/src/main/java/com/pixelgamelibrary/backend/libgdx/GraphicsLibGDXImpl.java b/pixel-backend-libgdx/src/main/java/com/pixelgamelibrary/backend/libgdx/GraphicsLibGDXImpl.java deleted file mode 100644 index 0f6bcd9..0000000 --- a/pixel-backend-libgdx/src/main/java/com/pixelgamelibrary/backend/libgdx/GraphicsLibGDXImpl.java +++ /dev/null @@ -1,97 +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.badlogic.gdx.Gdx; -import com.badlogic.gdx.Graphics; -import com.pixelgamelibrary.WindowMode; -import com.pixelgamelibrary.PixelException; -import java.util.Arrays; -import java.util.List; -import java.util.stream.Collectors; -import com.pixelgamelibrary.api.GraphicsI; - -/** - * - * @author robertvokac - */ -public class GraphicsLibGDXImpl implements GraphicsI { - - - @Override - public String setDisplayMode(boolean fullscreen, boolean window) { - - if (fullscreen) { - Graphics.Monitor currentMonitor = Gdx.graphics.getMonitor(); - Graphics.DisplayMode displayModeFromLibGdx = Gdx.graphics.getDisplayMode(currentMonitor); - if (originalDisplayMode == null) { - originalDisplayMode = displayModeFromLibGdx; - } - - Graphics.DisplayMode foundVgaDisplayMode = null; - //// -// System.out.println("started loading all display modes"); - List vgaDisplayModes = Arrays - .asList(Gdx.graphics.getDisplayModes(currentMonitor)) - .stream() - .filter(d -> d.width == 640 && d.height == 480) - .collect(Collectors.toList()); - -//fixme -// foundVgaDisplayMode = vgaDisplayModes.stream() -// .sorted((a, b) -> Integer.valueOf(a.refreshRate).compareTo(b.refreshRate)).findFirst().get(); -// System.out.println("ended loading all display modes"); -// System.out.println(foundVgaDisplayMode.refreshRate); -// System.out.println(foundVgaDisplayMode.width); -// System.out.println(foundVgaDisplayMode.height); - //// - if (!Gdx.graphics.setFullscreenMode(foundVgaDisplayMode == null ? displayModeFromLibGdx : foundVgaDisplayMode)) { - Gdx.app.error("InitScreen", "Switching to fullscreen mode failed."); - return null; - } - return WindowMode.FULLSCREEN; - - } - if (window) { - setToOriginalDisplayMode(); - Gdx.graphics.setWindowedMode(640, 480); - return WindowMode.WINDOW; - } - throw new PixelException("Unsupported DisplayMode: fullscreen=" + fullscreen + " window=" + window); - - } - @Override - public boolean setToOriginalDisplayMode() { - if (originalDisplayMode == null) { - //nothing to do - return true; - } - if (!Gdx.graphics.setFullscreenMode(originalDisplayMode)) { - Gdx.app.error("DefinitiveFrameworkLibGdxImpl", "Switching to original display mode failed."); - return false; - } else { - return true; - } - - } - - private Graphics.DisplayMode originalDisplayMode = null; - -} diff --git a/pixel-backend-libgdx/src/main/java/com/pixelgamelibrary/backend/libgdx/InputLibGDXImpl.java b/pixel-backend-libgdx/src/main/java/com/pixelgamelibrary/backend/libgdx/InputLibGDXImpl.java deleted file mode 100644 index 7172d2f..0000000 --- a/pixel-backend-libgdx/src/main/java/com/pixelgamelibrary/backend/libgdx/InputLibGDXImpl.java +++ /dev/null @@ -1,32 +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.InputI; - -/** - * - * @author robertvokac - */ -public class InputLibGDXImpl implements InputI { - - - -} diff --git a/pixel-backend-libgdx/src/main/java/com/pixelgamelibrary/backend/libgdx/NetLibGDXImpl.java b/pixel-backend-libgdx/src/main/java/com/pixelgamelibrary/backend/libgdx/NetLibGDXImpl.java deleted file mode 100644 index a98c42c..0000000 --- a/pixel-backend-libgdx/src/main/java/com/pixelgamelibrary/backend/libgdx/NetLibGDXImpl.java +++ /dev/null @@ -1,32 +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.NetI; - -/** - * - * @author robertvokac - */ -public class NetLibGDXImpl implements NetI { - - - -} diff --git a/pixel-backend-libgdx/src/main/java/com/pixelgamelibrary/backend/libgdx/PixelLibGDXBackend.gwt.xml b/pixel-backend-libgdx/src/main/java/com/pixelgamelibrary/backend/libgdx/PixelLibGDXBackend.gwt.xml deleted file mode 100644 index 8dd5046..0000000 --- a/pixel-backend-libgdx/src/main/java/com/pixelgamelibrary/backend/libgdx/PixelLibGDXBackend.gwt.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - \ No newline at end of file diff --git a/pixel-backend-libgdx/src/main/java/com/pixelgamelibrary/backend/libgdx/PixelLibGDXBackend.java b/pixel-backend-libgdx/src/main/java/com/pixelgamelibrary/backend/libgdx/PixelLibGDXBackend.java deleted file mode 100644 index 523b7c8..0000000 --- a/pixel-backend-libgdx/src/main/java/com/pixelgamelibrary/backend/libgdx/PixelLibGDXBackend.java +++ /dev/null @@ -1,121 +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.badlogic.gdx.Application; -import static com.badlogic.gdx.Application.ApplicationType.Desktop; -import com.badlogic.gdx.Gdx; -import com.pixelgamelibrary.PixelException; -import com.pixelgamelibrary.Platform; -import com.pixelgamelibrary.api.AppI; -import com.pixelgamelibrary.api.AssetI; -import com.pixelgamelibrary.api.AudioI; -import com.pixelgamelibrary.api.GraphicsI; -import com.pixelgamelibrary.api.InputI; -import com.pixelgamelibrary.api.UtilsI; -import com.pixelgamelibrary.api.StorageI; -import com.pixelgamelibrary.api.NetI; -import com.pixelgamelibrary.api.PixelBackend; - -/** - * - * @author robertvokac - */ -public class PixelLibGDXBackend 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; - - - @Override - public GraphicsI graphics() { - if (pixelGraphicsLibGdxImpl == null) { - pixelGraphicsLibGdxImpl = new GraphicsLibGDXImpl(); - } - return pixelGraphicsLibGdxImpl; - } - - @Override - public AudioI audio() { - - if (pixelAudioLibGdxImpl == null) { - pixelAudioLibGdxImpl = new AudioLibGDXImpl(); - } - return pixelAudioLibGdxImpl; - } - - @Override - public InputI input() { - - if (pixelInputLibGdxImpl == null) { - pixelInputLibGdxImpl = new InputLibGDXImpl(); - } - return pixelInputLibGdxImpl; - } - - @Override - public NetI net() { - - if (pixelNetLibGdxImpl == null) { - pixelNetLibGdxImpl = new NetLibGDXImpl(); - } - return pixelNetLibGdxImpl; - } - - @Override - public AssetI asset() { - - if (pixelAssetLibGdxImpl == null) { - pixelAssetLibGdxImpl = new AssetLibGDXImpl(); - } - return pixelAssetLibGdxImpl; - } - - @Override - public StorageI storage() { - - if (pixelStorageLibGdxImpl == null) { - pixelStorageLibGdxImpl = new StorageLibGDXImpl(); - } - return pixelStorageLibGdxImpl; - } - - @Override - public UtilsI utils() { - - if (pixelUtilsLibGdxImpl == null) { - pixelUtilsLibGdxImpl = new UtilsLibGDXImpl(); - } - return pixelUtilsLibGdxImpl; } - - @Override - public AppI app() { - if (pixelAppLibGdxImpl == null) { - pixelAppLibGdxImpl = new AppLibGDXImpl(); - } - return pixelAppLibGdxImpl; } - -} diff --git a/pixel-backend-libgdx/src/main/java/com/pixelgamelibrary/backend/libgdx/StorageLibGDXImpl.java b/pixel-backend-libgdx/src/main/java/com/pixelgamelibrary/backend/libgdx/StorageLibGDXImpl.java deleted file mode 100644 index 034e6b4..0000000 --- a/pixel-backend-libgdx/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.StorageI; -import com.pixelgamelibrary.backend.libgdx.storage.StorageFactory; -import com.pixelgamelibrary.storage.Storage; - -/** - * - * @author robertvokac - */ -public class StorageLibGDXImpl implements StorageI { - - @Override - public Storage getStorage() { - return StorageFactory.getStorage(); - } - - - -} diff --git a/pixel-backend-libgdx/src/main/java/com/pixelgamelibrary/backend/libgdx/UtilsLibGDXImpl.java b/pixel-backend-libgdx/src/main/java/com/pixelgamelibrary/backend/libgdx/UtilsLibGDXImpl.java deleted file mode 100644 index ee0aae5..0000000 --- a/pixel-backend-libgdx/src/main/java/com/pixelgamelibrary/backend/libgdx/UtilsLibGDXImpl.java +++ /dev/null @@ -1,49 +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.badlogic.gdx.utils.Base64Coder; -import com.badlogic.gdx.utils.XmlReader; -import com.pixelgamelibrary.api.XmlElement; -import com.pixelgamelibrary.api.UtilsI; - -/** - * - * @author robertvokac - */ -public class UtilsLibGDXImpl implements UtilsI { - - @Override - public XmlElement parseXml(String xmlString) { - XmlReader.Element root = new XmlReader().parse(xmlString); - return new ElementLibGDXImpl(root); - - } - - public byte[] decodeBase64AsByteArray(String string) { - return Base64Coder.decode(string); - } - - public String encodeToBase64(byte[] data) { - return String.valueOf(Base64Coder.encode(data)); - } - - -} diff --git a/pixel-backend-libgdx/src/main/java/com/pixelgamelibrary/backend/libgdx/storage/AndroidStorage.java b/pixel-backend-libgdx/src/main/java/com/pixelgamelibrary/backend/libgdx/storage/AndroidStorage.java deleted file mode 100644 index 0e2b9da..0000000 --- a/pixel-backend-libgdx/src/main/java/com/pixelgamelibrary/backend/libgdx/storage/AndroidStorage.java +++ /dev/null @@ -1,36 +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.storage; - -import com.pixelgamelibrary.Platform; - -/** - * - * @author robertvokac - */ -public class AndroidStorage extends DesktopAndroidStorage { - - public AndroidStorage() { - } - - public Platform getPlatform() { - return Platform.ANDROID; - } -} diff --git a/pixel-backend-libgdx/src/main/java/com/pixelgamelibrary/backend/libgdx/storage/DesktopAndroidStorage.java b/pixel-backend-libgdx/src/main/java/com/pixelgamelibrary/backend/libgdx/storage/DesktopAndroidStorage.java deleted file mode 100644 index a711310..0000000 --- a/pixel-backend-libgdx/src/main/java/com/pixelgamelibrary/backend/libgdx/storage/DesktopAndroidStorage.java +++ /dev/null @@ -1,134 +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.storage; - -import com.pixelgamelibrary.Platform; -import com.pixelgamelibrary.storage.Storage; -import java.util.List; - -/** - * - * @author robertvokac - */ -public abstract class DesktopAndroidStorage implements Storage { - - public DesktopAndroidStorage() { - } - - @Override - public Platform getPlatform() { - throw new UnsupportedOperationException("Not supported yet."); // Generated from nbfs://nbhost/SystemFileSystem/Templates/Classes/Code/GeneratedMethodBody - } - - @Override - public String cd(String path) { - throw new UnsupportedOperationException("Not supported yet."); // Generated from nbfs://nbhost/SystemFileSystem/Templates/Classes/Code/GeneratedMethodBody - } - - @Override - public String mkdir(String name) { - throw new UnsupportedOperationException("Not supported yet."); // Generated from nbfs://nbhost/SystemFileSystem/Templates/Classes/Code/GeneratedMethodBody - } - - @Override - public String pwd() { - throw new UnsupportedOperationException("Not supported yet."); // Generated from nbfs://nbhost/SystemFileSystem/Templates/Classes/Code/GeneratedMethodBody - } - - @Override - public List ls(String path) { - throw new UnsupportedOperationException("Not supported yet."); // Generated from nbfs://nbhost/SystemFileSystem/Templates/Classes/Code/GeneratedMethodBody - } - - @Override - public int depth(String path) { - throw new UnsupportedOperationException("Not supported yet."); // Generated from nbfs://nbhost/SystemFileSystem/Templates/Classes/Code/GeneratedMethodBody - } - - @Override - public String touch(String name) { - throw new UnsupportedOperationException("Not supported yet."); // Generated from nbfs://nbhost/SystemFileSystem/Templates/Classes/Code/GeneratedMethodBody - } - - @Override - public boolean rm(String name) { - throw new UnsupportedOperationException("Not supported yet."); // Generated from nbfs://nbhost/SystemFileSystem/Templates/Classes/Code/GeneratedMethodBody - } - - @Override - public String cp(String source, String target) { - throw new UnsupportedOperationException("Not supported yet."); // Generated from nbfs://nbhost/SystemFileSystem/Templates/Classes/Code/GeneratedMethodBody - } - - @Override - public String mv(String source, String target) { - throw new UnsupportedOperationException("Not supported yet."); // Generated from nbfs://nbhost/SystemFileSystem/Templates/Classes/Code/GeneratedMethodBody - } - - @Override - public String readtext(String name) { - throw new UnsupportedOperationException("Not supported yet."); // Generated from nbfs://nbhost/SystemFileSystem/Templates/Classes/Code/GeneratedMethodBody - } - - @Override - public byte[] readbin(String name) { - throw new UnsupportedOperationException("Not supported yet."); // Generated from nbfs://nbhost/SystemFileSystem/Templates/Classes/Code/GeneratedMethodBody - } - - @Override - public String savetext(String name, String text) { - throw new UnsupportedOperationException("Not supported yet."); // Generated from nbfs://nbhost/SystemFileSystem/Templates/Classes/Code/GeneratedMethodBody - } - - @Override - public String savebin(String name, byte[] data) { - throw new UnsupportedOperationException("Not supported yet."); // Generated from nbfs://nbhost/SystemFileSystem/Templates/Classes/Code/GeneratedMethodBody - } - - @Override - public boolean exists(String name) { - throw new UnsupportedOperationException("Not supported yet."); // Generated from nbfs://nbhost/SystemFileSystem/Templates/Classes/Code/GeneratedMethodBody - } - - @Override - public boolean isfile(String name) { - throw new UnsupportedOperationException("Not supported yet."); // Generated from nbfs://nbhost/SystemFileSystem/Templates/Classes/Code/GeneratedMethodBody - } - - @Override - public boolean isdir(String name) { - throw new UnsupportedOperationException("Not supported yet."); // Generated from nbfs://nbhost/SystemFileSystem/Templates/Classes/Code/GeneratedMethodBody - } - - @Override - public String debug() { - throw new UnsupportedOperationException("Not supported yet."); // Generated from nbfs://nbhost/SystemFileSystem/Templates/Classes/Code/GeneratedMethodBody - } - - @Override - public void flush() { - //nothing to do - } - - @Override - public boolean rmdir(String dirname) { - throw new UnsupportedOperationException("Not supported yet."); // Generated from nbfs://nbhost/SystemFileSystem/Templates/Classes/Code/GeneratedMethodBody - } -} diff --git a/pixel-backend-libgdx/src/main/java/com/pixelgamelibrary/backend/libgdx/storage/DesktopStorage.java b/pixel-backend-libgdx/src/main/java/com/pixelgamelibrary/backend/libgdx/storage/DesktopStorage.java deleted file mode 100644 index 9baa74c..0000000 --- a/pixel-backend-libgdx/src/main/java/com/pixelgamelibrary/backend/libgdx/storage/DesktopStorage.java +++ /dev/null @@ -1,36 +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.storage; - -import com.pixelgamelibrary.Platform; - -/** - * - * @author robertvokac - */ -public class DesktopStorage extends DesktopAndroidStorage { - - public DesktopStorage() { - } - - public Platform getPlatform() { - return Platform.DESKTOP; - } -} diff --git a/pixel-backend-libgdx/src/main/java/com/pixelgamelibrary/backend/libgdx/storage/SimpleLocalStorageMap.java b/pixel-backend-libgdx/src/main/java/com/pixelgamelibrary/backend/libgdx/storage/SimpleLocalStorageMap.java deleted file mode 100644 index 2b8bee2..0000000 --- a/pixel-backend-libgdx/src/main/java/com/pixelgamelibrary/backend/libgdx/storage/SimpleLocalStorageMap.java +++ /dev/null @@ -1,100 +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.storage; - -import com.badlogic.gdx.Preferences; -import com.pixelgamelibrary.storage.map.SimpleMap; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.stream.Collectors; - -/** - * - * @author robertvokac - */ -public class SimpleLocalStorageMap implements SimpleMap { - - private final Preferences preferences; - - public SimpleLocalStorageMap(Preferences preferencesIn) { - this.preferences = preferencesIn; - } - - @Override - public void putString(String key, String val) { - preferences.putString(key, val); - } - - @Override - public void put(Map map) { - preferences.put(map); - } - - @Override - public String getString(String key) { - return preferences.getString(key); - } - - @Override - public String getString(String key, String defaultValue) { - return preferences.getString(key, defaultValue); - } - - @Override - public Map getReadOnlyMap() { - Map map = preferences.get(); - Map result = new HashMap<>(); - for (String key : map.keySet()) { - Object o = map.get(key); - if (o instanceof String) { - result.put(key, (String) o); - } - } - return Collections.unmodifiableMap(result); - } - - @Override - public boolean contains(String key) { - return preferences.contains(key); - } - - @Override - public void clear() { - preferences.clear(); - } - - @Override - public void remove(String key) { - preferences.remove(key); - } - - @Override - public void flush() { - preferences.flush(); - } - - @Override - public List keyList() { - return preferences.get().keySet().stream().collect(Collectors.toList()); - } - -} diff --git a/pixel-backend-libgdx/src/main/java/com/pixelgamelibrary/backend/libgdx/storage/StorageFactory.java b/pixel-backend-libgdx/src/main/java/com/pixelgamelibrary/backend/libgdx/storage/StorageFactory.java deleted file mode 100644 index e86dc16..0000000 --- a/pixel-backend-libgdx/src/main/java/com/pixelgamelibrary/backend/libgdx/storage/StorageFactory.java +++ /dev/null @@ -1,62 +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.storage; - -import com.pixelgamelibrary.storage.map.MemoryStorage; -import com.pixelgamelibrary.Pixel; -import com.pixelgamelibrary.Platform; -import com.pixelgamelibrary.storage.Storage; -import com.pixelgamelibrary.storage.StorageException; - -/** - * - * @author robertvokac - */ -public class StorageFactory { - - private StorageFactory() { - //Not meant to be instantiated. - } - private static Storage storage = null; - - public static Storage getStorage() { - final Platform platform = Pixel.app().getPlatform(); - if (storage == null) { - storage = new MemoryStorage(); - } - if (storage == null) { - - if (platform.isDesktop()) { - storage = new DesktopStorage(); - } - if (platform.isAndroid()) { - storage = new AndroidStorage(); - } - if (platform.isWeb()) { - storage = new WebGLStorage(); - } - } - if (storage == null) { - throw new StorageException("Platform is not supported: " + platform); - } - return storage; - } - -} diff --git a/pixel-backend-libgdx/src/main/java/com/pixelgamelibrary/backend/libgdx/storage/WebGLStorage.java b/pixel-backend-libgdx/src/main/java/com/pixelgamelibrary/backend/libgdx/storage/WebGLStorage.java deleted file mode 100644 index 4508621..0000000 --- a/pixel-backend-libgdx/src/main/java/com/pixelgamelibrary/backend/libgdx/storage/WebGLStorage.java +++ /dev/null @@ -1,49 +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.storage; - -import com.badlogic.gdx.Gdx; -import com.badlogic.gdx.Preferences; -import com.pixelgamelibrary.Platform; -import com.pixelgamelibrary.storage.map.MapStorage; - -/** - * - * @author robertvokac - */ -public class WebGLStorage extends MapStorage { - - public Platform getPlatform() { - return Platform.WEB; - } - - public WebGLStorage() { - this("pixel.libgdx.webGL.Local-Storage"); - } - - public WebGLStorage(String preferencesName) { - this(Gdx.app.getPreferences(preferencesName)); - } - - public WebGLStorage(Preferences preferences) { - super(new SimpleLocalStorageMap(preferences)); - } - -} diff --git a/pixel-backend-libgdx/src/test/java/com/pixelgamelibrary/.gitkeep b/pixel-backend-libgdx/src/test/java/com/pixelgamelibrary/.gitkeep deleted file mode 100644 index 8d1c8b6..0000000 --- a/pixel-backend-libgdx/src/test/java/com/pixelgamelibrary/.gitkeep +++ /dev/null @@ -1 +0,0 @@ - diff --git a/settings.gradle b/settings.gradle index da5a7ea..635c719 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1,4 +1,4 @@ // A list of which subprojects to load as part of the same larger project. // You can remove Strings from the list and reload the Gradle project // if you want to temporarily disable a subproject. -include 'lwjgl3', 'android', 'html', 'core', 'pixel-backend-libgdx' +include 'lwjgl3', 'android', 'html', 'core'