Prechádzať zdrojové kódy

jinput: fix native loading

Kirill Vainer 9 rokov pred
rodič
commit
2fc4e5b607

+ 1 - 0
jme3-jinput/build.gradle

@@ -6,6 +6,7 @@ dependencies {
     compile project(':jme3-core')
     compile project(':jme3-desktop')
     compile 'net.java.jinput:jinput:2.0.6'
+    compile 'net.java.jinput:jinput-platform:2.0.6'
 
     testCompile project(path: ':jme3-core', configuration: 'testOutput')
 }

+ 7 - 0
jme3-jinput/src/main/java/com/jme3/input/jinput/JInputJoyInput.java

@@ -12,6 +12,7 @@ import com.jme3.input.JoystickCompatibilityMappings;
 import com.jme3.input.RawInputListener;
 import com.jme3.input.event.JoyAxisEvent;
 import com.jme3.input.event.JoyButtonEvent;
+import com.jme3.system.NativeLibraryLoader;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
@@ -73,6 +74,12 @@ public class JInputJoyInput implements JoyInput {
     @Override
     public void initialize() {
         inited = true;
+
+        // Load natives
+        String extractPath = NativeLibraryLoader.getExtractionFolder().getAbsolutePath();
+        System.setProperty("net.java.games.input.librarypath", extractPath);
+        NativeLibraryLoader.loadNativeLibrary("jinput", true, false);
+        NativeLibraryLoader.loadNativeLibrary("jinput-dx8", true, false);
     }
 
     @Override

+ 0 - 5
jme3-lwjgl/src/main/java/com/jme3/system/lwjgl/LwjglContext.java

@@ -172,11 +172,6 @@ public abstract class LwjglContext implements JmeContext {
         if ("LWJGL".equals(settings.getAudioRenderer())) {
             NativeLibraryLoader.loadNativeLibrary("openal", true);
         }
-        if (settings.useJoysticks()) {
-            System.setProperty("net.java.games.input.librarypath", extractPath);
-            NativeLibraryLoader.loadNativeLibrary("jinput", true, false);
-            NativeLibraryLoader.loadNativeLibrary("jinput-dx8", true, false);
-        }
         if (NativeLibraryLoader.isUsingNativeBullet()) {
             NativeLibraryLoader.loadNativeLibrary("bulletjme", true);
         }