From 0eea5e2793b7bacd487a54626df1a2c8f87097b3 Mon Sep 17 00:00:00 2001 From: Collin Smith Date: Fri, 28 May 2021 15:30:15 -0700 Subject: [PATCH] Migrated libgdx 1.9.13 -> 1.9.14 Migrated libgdx 1.9.13 -> 1.9.14 Removed gdx-jnigen dependency (waterfalled from within gdx-video correctly now) Separated gdx-controllers version 1.9.14 -> 2.2.0 Changed HeadlessApplicationConfiguration#renderInterval to #updatedPerSecond --- android/build.gradle | 2 +- android/proguard-rules.pro | 2 +- core/build.gradle | 2 +- .../src/main/java/com/riiablo/screen/MenuScreen.java | 12 ++++++++---- desktop/build.gradle | 3 +-- gradle.properties | 3 ++- .../src/main/java/com/riiablo/server/d2gs/D2GS.java | 2 +- .../java/com/riiablo/onet/reliable/TestClient.java | 2 +- .../java/com/riiablo/onet/reliable/TestServer.java | 2 +- .../main/java/com/riiablo/onet/tcp/TestClient.java | 2 +- .../main/java/com/riiablo/onet/tcp/TestServer.java | 2 +- .../src/main/java/com/riiablo/server/d2gs/Main.java | 2 +- .../java/com/riiablo/server/d2gs_netty/Main.java | 2 +- .../main/java/com/riiablo/server/d2gs_test/Main.java | 2 +- .../com/riiablo/server/d2gs_test/TestClient.java | 2 +- .../main/java/com/riiablo/server/netty/Client.java | 2 +- .../src/main/java/com/riiablo/server/netty/Main.java | 2 +- tools/video-player/build.gradle | 1 - 18 files changed, 25 insertions(+), 22 deletions(-) diff --git a/android/build.gradle b/android/build.gradle index 9138fb9b..4fde7e72 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -48,7 +48,7 @@ dependencies { natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-arm64-v8a" natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-x86" natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-x86_64" - implementation "com.badlogicgames.gdx:gdx-controllers-android:$gdxVersion" + implementation "com.badlogicgames.gdx-controllers:gdx-controllers-android:$gdxControllersVersion" } dependencies { diff --git a/android/proguard-rules.pro b/android/proguard-rules.pro index b166b1e8..8abec7f6 100644 --- a/android/proguard-rules.pro +++ b/android/proguard-rules.pro @@ -28,7 +28,7 @@ -dontwarn com.badlogic.gdx.jnigen.BuildTarget* -dontwarn com.badlogic.gdx.graphics.g2d.freetype.FreetypeBuild --keep class com.badlogic.gdx.controllers.android.AndroidControllers +-keep class com.badlogic.gdx.controllers.android.AndroidControllers { *; } -keepclassmembers class com.badlogic.gdx.backends.android.AndroidInput* { (com.badlogic.gdx.Application, android.content.Context, java.lang.Object, com.badlogic.gdx.backends.android.AndroidApplicationConfiguration); diff --git a/core/build.gradle b/core/build.gradle index abf12e16..f4605d8b 100644 --- a/core/build.gradle +++ b/core/build.gradle @@ -31,7 +31,7 @@ dependencies { api "com.badlogicgames.gdx:gdx:$gdxVersion" api "com.badlogicgames.gdx:gdx-backend-lwjgl:$gdxVersion" api "com.badlogicgames.gdx:gdx-ai:$gdxAiVersion" - api "com.badlogicgames.gdx:gdx-controllers:$gdxVersion" + api "com.badlogicgames.gdx-controllers:gdx-controllers-core:$gdxControllersVersion" } // Libraries diff --git a/core/src/main/java/com/riiablo/screen/MenuScreen.java b/core/src/main/java/com/riiablo/screen/MenuScreen.java index ca48dff2..c5e95b77 100644 --- a/core/src/main/java/com/riiablo/screen/MenuScreen.java +++ b/core/src/main/java/com/riiablo/screen/MenuScreen.java @@ -8,8 +8,6 @@ import com.badlogic.gdx.controllers.Controller; import com.badlogic.gdx.controllers.ControllerAdapter; import com.badlogic.gdx.controllers.ControllerListener; import com.badlogic.gdx.controllers.Controllers; -import com.badlogic.gdx.controllers.PovDirection; -import com.badlogic.gdx.controllers.mappings.Xbox; import com.badlogic.gdx.graphics.g2d.TextureRegion; import com.badlogic.gdx.math.Vector2; import com.badlogic.gdx.scenes.scene2d.Actor; @@ -178,10 +176,10 @@ public class MenuScreen extends ScreenAdapter { @Override public boolean buttonDown(Controller controller, int buttonIndex) { System.out.println(buttonIndex); - if (buttonIndex == Xbox.A) { + if (buttonIndex == controller.getMapping().buttonA) { EventUtils.click((Button) focus); return true; - } else if (buttonIndex == Xbox.B) { + } else if (buttonIndex == controller.getMapping().buttonB) { EventUtils.click(btnExitDiablo); return true; } @@ -189,6 +187,11 @@ public class MenuScreen extends ScreenAdapter { return false; } + /* + * This API changed and no longer exists. + * Functionality need to migrate into #buttonDown I think + */ + /* @Override public boolean povMoved(Controller controller, int povIndex, PovDirection value) { System.out.println(povIndex + " " + value); @@ -213,6 +216,7 @@ public class MenuScreen extends ScreenAdapter { return false; } + */ @Override public boolean axisMoved(Controller controller, int axisIndex, float value) { diff --git a/desktop/build.gradle b/desktop/build.gradle index 2736cdac..3a32855c 100644 --- a/desktop/build.gradle +++ b/desktop/build.gradle @@ -11,8 +11,7 @@ dependencies { implementation project(':core') implementation "com.badlogicgames.gdx:gdx-backend-lwjgl:$gdxVersion" implementation "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-desktop" - implementation "com.badlogicgames.gdx:gdx-controllers-desktop:$gdxVersion" - implementation "com.badlogicgames.gdx:gdx-controllers-platform:$gdxVersion:natives-desktop" + implementation "com.badlogicgames.gdx-controllers:gdx-controllers-desktop:$gdxControllersVersion" implementation "com.badlogicgames.gdx:gdx-box2d-platform:$gdxVersion:natives-desktop" implementation "commons-cli:commons-cli:$cliVersion" diff --git a/gradle.properties b/gradle.properties index c461cc86..942d1086 100644 --- a/gradle.properties +++ b/gradle.properties @@ -4,7 +4,8 @@ org.gradle.configureondemand=false androidBuildToolsPluginVersion=4.1.1 flatbuffersPluginVersion=1.0.7 -gdxVersion=1.9.13 +gdxVersion=1.9.14 +gdxControllersVersion=2.2.0 artemisOdbVersion=2.3.0 artemisContribVersion=2.4.0 gdxAiVersion=1.8.2 diff --git a/server/d2gs/src/main/java/com/riiablo/server/d2gs/D2GS.java b/server/d2gs/src/main/java/com/riiablo/server/d2gs/D2GS.java index 2c32c1a9..acd1ecae 100644 --- a/server/d2gs/src/main/java/com/riiablo/server/d2gs/D2GS.java +++ b/server/d2gs/src/main/java/com/riiablo/server/d2gs/D2GS.java @@ -160,7 +160,7 @@ public class D2GS extends ApplicationAdapter { } HeadlessApplicationConfiguration config = new HeadlessApplicationConfiguration(); - config.renderInterval = Animation.FRAME_DURATION; + config.updatesPerSecond = (int) Animation.FRAMES_PER_SECOND; new HeadlessApplication(new D2GS(home, seed, diff), config); } diff --git a/server/netty/src/main/java/com/riiablo/onet/reliable/TestClient.java b/server/netty/src/main/java/com/riiablo/onet/reliable/TestClient.java index 53b5ec2a..d63cfa90 100644 --- a/server/netty/src/main/java/com/riiablo/onet/reliable/TestClient.java +++ b/server/netty/src/main/java/com/riiablo/onet/reliable/TestClient.java @@ -35,7 +35,7 @@ public class TestClient extends ApplicationAdapter implements PacketProcessor { public static void main(String[] args) throws Exception { Thread.sleep(1000); HeadlessApplicationConfiguration config = new HeadlessApplicationConfiguration(); - config.renderInterval = Animation.FRAME_DURATION; + config.updatesPerSecond = (int) Animation.FRAMES_PER_SECOND; new HeadlessApplication(new TestClient(), config); } diff --git a/server/netty/src/main/java/com/riiablo/onet/reliable/TestServer.java b/server/netty/src/main/java/com/riiablo/onet/reliable/TestServer.java index f474516e..a19f89a2 100644 --- a/server/netty/src/main/java/com/riiablo/onet/reliable/TestServer.java +++ b/server/netty/src/main/java/com/riiablo/onet/reliable/TestServer.java @@ -35,7 +35,7 @@ public class TestServer extends ApplicationAdapter implements PacketProcessor { public static void main(String[] args) { HeadlessApplicationConfiguration config = new HeadlessApplicationConfiguration(); - config.renderInterval = Animation.FRAME_DURATION; + config.updatesPerSecond = (int) Animation.FRAMES_PER_SECOND; new HeadlessApplication(new TestServer(), config); } diff --git a/server/netty/src/main/java/com/riiablo/onet/tcp/TestClient.java b/server/netty/src/main/java/com/riiablo/onet/tcp/TestClient.java index 89060724..604b2884 100644 --- a/server/netty/src/main/java/com/riiablo/onet/tcp/TestClient.java +++ b/server/netty/src/main/java/com/riiablo/onet/tcp/TestClient.java @@ -36,7 +36,7 @@ public class TestClient extends ApplicationAdapter implements PacketProcessor { public static void main(String[] args) throws Exception { Thread.sleep(1000); HeadlessApplicationConfiguration config = new HeadlessApplicationConfiguration(); - config.renderInterval = Animation.FRAME_DURATION; + config.updatesPerSecond = (int) Animation.FRAMES_PER_SECOND; new HeadlessApplication(new TestClient(), config); } diff --git a/server/netty/src/main/java/com/riiablo/onet/tcp/TestServer.java b/server/netty/src/main/java/com/riiablo/onet/tcp/TestServer.java index a4706967..9113d0f2 100644 --- a/server/netty/src/main/java/com/riiablo/onet/tcp/TestServer.java +++ b/server/netty/src/main/java/com/riiablo/onet/tcp/TestServer.java @@ -31,7 +31,7 @@ public class TestServer extends ApplicationAdapter implements PacketProcessor { public static void main(String[] args) throws Exception { HeadlessApplicationConfiguration config = new HeadlessApplicationConfiguration(); - config.renderInterval = Animation.FRAME_DURATION; + config.updatesPerSecond = (int) Animation.FRAMES_PER_SECOND; new HeadlessApplication(new TestServer(), config); } diff --git a/server/netty/src/main/java/com/riiablo/server/d2gs/Main.java b/server/netty/src/main/java/com/riiablo/server/d2gs/Main.java index 7e1470cb..37043543 100644 --- a/server/netty/src/main/java/com/riiablo/server/d2gs/Main.java +++ b/server/netty/src/main/java/com/riiablo/server/d2gs/Main.java @@ -118,7 +118,7 @@ public class Main extends ApplicationAdapter { } HeadlessApplicationConfiguration config = new HeadlessApplicationConfiguration(); - config.renderInterval = Animation.FRAME_DURATION; + config.updatesPerSecond = (int) Animation.FRAMES_PER_SECOND; new HeadlessApplication(new Main(home, seed, diff), config); } diff --git a/server/netty/src/main/java/com/riiablo/server/d2gs_netty/Main.java b/server/netty/src/main/java/com/riiablo/server/d2gs_netty/Main.java index 911b0aff..8fba137a 100644 --- a/server/netty/src/main/java/com/riiablo/server/d2gs_netty/Main.java +++ b/server/netty/src/main/java/com/riiablo/server/d2gs_netty/Main.java @@ -118,7 +118,7 @@ public class Main extends ApplicationAdapter { } HeadlessApplicationConfiguration config = new HeadlessApplicationConfiguration(); - config.renderInterval = Animation.FRAME_DURATION; + config.updatesPerSecond = (int) Animation.FRAMES_PER_SECOND; new HeadlessApplication(new Main(home, seed, diff), config); } diff --git a/server/netty/src/main/java/com/riiablo/server/d2gs_test/Main.java b/server/netty/src/main/java/com/riiablo/server/d2gs_test/Main.java index ae78834b..582a4ba0 100644 --- a/server/netty/src/main/java/com/riiablo/server/d2gs_test/Main.java +++ b/server/netty/src/main/java/com/riiablo/server/d2gs_test/Main.java @@ -46,7 +46,7 @@ public class Main extends ApplicationAdapter implements PacketProcessor { public static void main(String[] args) { HeadlessApplicationConfiguration config = new HeadlessApplicationConfiguration(); - config.renderInterval = Animation.FRAME_DURATION; + config.updatesPerSecond = (int) Animation.FRAMES_PER_SECOND; new HeadlessApplication(new Main(), config); } diff --git a/server/netty/src/main/java/com/riiablo/server/d2gs_test/TestClient.java b/server/netty/src/main/java/com/riiablo/server/d2gs_test/TestClient.java index 257ab813..1bb7161d 100644 --- a/server/netty/src/main/java/com/riiablo/server/d2gs_test/TestClient.java +++ b/server/netty/src/main/java/com/riiablo/server/d2gs_test/TestClient.java @@ -38,7 +38,7 @@ public class TestClient extends ApplicationAdapter implements PacketProcessor { public static void main(String[] args) throws Exception { Thread.sleep(1000); HeadlessApplicationConfiguration config = new HeadlessApplicationConfiguration(); - config.renderInterval = Animation.FRAME_DURATION; + config.updatesPerSecond = (int) Animation.FRAMES_PER_SECOND; new HeadlessApplication(new TestClient(), config); } diff --git a/server/netty/src/main/java/com/riiablo/server/netty/Client.java b/server/netty/src/main/java/com/riiablo/server/netty/Client.java index 2fc5eafa..c68d131f 100644 --- a/server/netty/src/main/java/com/riiablo/server/netty/Client.java +++ b/server/netty/src/main/java/com/riiablo/server/netty/Client.java @@ -32,7 +32,7 @@ public class Client extends ApplicationAdapter { public static void main(String[] args) throws Exception { Thread.sleep(1000); HeadlessApplicationConfiguration config = new HeadlessApplicationConfiguration(); - config.renderInterval = Animation.FRAME_DURATION; + config.updatesPerSecond = (int) Animation.FRAMES_PER_SECOND; new HeadlessApplication(new Client(), config); } diff --git a/server/netty/src/main/java/com/riiablo/server/netty/Main.java b/server/netty/src/main/java/com/riiablo/server/netty/Main.java index ffb56c4e..a5b85eec 100644 --- a/server/netty/src/main/java/com/riiablo/server/netty/Main.java +++ b/server/netty/src/main/java/com/riiablo/server/netty/Main.java @@ -53,7 +53,7 @@ public class Main extends ApplicationAdapter { // TODO: process args and setup server HeadlessApplicationConfiguration config = new HeadlessApplicationConfiguration(); - config.renderInterval = Animation.FRAME_DURATION; + config.updatesPerSecond = (int) Animation.FRAMES_PER_SECOND; new HeadlessApplication(new Main(), config); } diff --git a/tools/video-player/build.gradle b/tools/video-player/build.gradle index 1a6974b2..2669ab70 100644 --- a/tools/video-player/build.gradle +++ b/tools/video-player/build.gradle @@ -2,7 +2,6 @@ description = 'Play videos from MPQ archives.' application.mainClass = 'com.riiablo.video.VideoPlayerTool' dependencies { - implementation "com.badlogicgames.gdx:gdx-jnigen:$gdxVersion" implementation "com.badlogicgames.gdx-video:gdx-video:1.3.2-SNAPSHOT" implementation "com.badlogicgames.gdx-video:gdx-video-lwjgl:1.3.2-SNAPSHOT" }