Skip to content

Commit

Permalink
[libgdx] Remove dependency on gdx-lwjgl3-glfw-awt-macos in SkeletonVi…
Browse files Browse the repository at this point in the history
…ewer, use LWJGL glfw_async instead

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.
  • Loading branch information
badlogic committed Aug 20, 2024
1 parent d0e94ba commit 6fa31a2
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
14 changes: 10 additions & 4 deletions spine-libgdx/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ allprojects {
mavenCentral()
}

// Set Java 8 compatibility using JDK 17
tasks.withType(JavaCompile).configureEach {
sourceCompatibility = '1.7'
targetCompatibility = '1.7'
Expand Down Expand Up @@ -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")) {
Expand All @@ -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"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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;
}
Expand Down

0 comments on commit 6fa31a2

Please sign in to comment.