From 6fa31a29032611337479ce1f63ac8d7b0d005be6 Mon Sep 17 00:00:00 2001 From: Mario Zechner Date: Tue, 20 Aug 2024 16:14:50 +0200 Subject: [PATCH] =?UTF-8?q?[libgdx]=C2=A0Remove=20dependency=20on=20gdx-lw?= =?UTF-8?q?jgl3-glfw-awt-macos=20in=20SkeletonViewer,=20use=20LWJGL=20glfw?= =?UTF-8?q?=5Fasync=20instead?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Same deficiency: when resizing, it will eventually crash with ``` UNSUPPORTED (log once): setPrimitiveRestartEnabled:index: unsupported! -[AGXG13XFamilyCommandBuffer renderCommandEncoderWithDescriptor:]:888: failed assertion `A command encoder is already encoding to this command buffer' ``` Not sure how to work around this. JGLFW does not have this issue. --- spine-libgdx/build.gradle | 14 ++++++++++---- .../com/esotericsoftware/spine/SkeletonViewer.java | 3 +++ 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/spine-libgdx/build.gradle b/spine-libgdx/build.gradle index c9d4b93cd4..7663b2e13d 100644 --- a/spine-libgdx/build.gradle +++ b/spine-libgdx/build.gradle @@ -13,7 +13,6 @@ allprojects { mavenCentral() } - // Set Java 8 compatibility using JDK 17 tasks.withType(JavaCompile).configureEach { sourceCompatibility = '1.7' targetCompatibility = '1.7' @@ -43,11 +42,19 @@ project("spine-skeletonviewer") { from { configurations.runtimeClasspath.collect { it.isDirectory() ? it : zipTree(it) } } - } - tasks.named('jar').configure { dependsOn(project(":spine-libgdx").tasks.named('jar')) } + + tasks.named('build').configure { + dependsOn(tasks.named('jar')) + } + + tasks.withType(JavaCompile).configureEach { + sourceCompatibility = '1.8' + targetCompatibility = '1.8' + options.release.set(8) // Ensures Java 8 bytecode is produced + } } configure(subprojects - project("spine-libgdx")) { @@ -58,7 +65,6 @@ configure(subprojects - project("spine-libgdx")) { implementation "com.badlogicgames.gdx:gdx:$libgdxVersion" implementation "com.badlogicgames.gdx:gdx-platform:$libgdxVersion:natives-desktop" implementation "com.badlogicgames.gdx:gdx-backend-lwjgl3:$libgdxVersion" - implementation "com.badlogicgames.gdx:gdx-lwjgl3-glfw-awt-macos:$libgdxVersion" implementation "com.badlogicgames.gdx:gdx-box2d:$libgdxVersion" implementation "com.badlogicgames.gdx:gdx-box2d-platform:$libgdxVersion:natives-desktop" } diff --git a/spine-libgdx/spine-skeletonviewer/src/com/esotericsoftware/spine/SkeletonViewer.java b/spine-libgdx/spine-skeletonviewer/src/com/esotericsoftware/spine/SkeletonViewer.java index 15a57cb9c2..b91f898d5d 100644 --- a/spine-libgdx/spine-skeletonviewer/src/com/esotericsoftware/spine/SkeletonViewer.java +++ b/spine-libgdx/spine-skeletonviewer/src/com/esotericsoftware/spine/SkeletonViewer.java @@ -54,6 +54,7 @@ import com.esotericsoftware.spine.AnimationState.TrackEntry; import com.esotericsoftware.spine.Skeleton.Physics; import com.esotericsoftware.spine.utils.TwoColorPolygonBatch; +import org.lwjgl.system.Configuration; import java.awt.Toolkit; @@ -377,6 +378,8 @@ static public void main (String[] args) throws Exception { float dpiScale = 1; if (os.contains("Windows")) dpiScale = Toolkit.getDefaultToolkit().getScreenResolution() / 96f; if (os.contains("OS X")) { + Configuration.GLFW_CHECK_THREAD0.set(false); + Configuration.GLFW_LIBRARY_NAME.set("glfw_async"); Object object = Toolkit.getDefaultToolkit().getDesktopProperty("apple.awt.contentScaleFactor"); if (object instanceof Float && ((Float)object).intValue() >= 2) dpiScale = 2; }