From 80adca6dce69052eea87df1fe863ccca3df1b6a7 Mon Sep 17 00:00:00 2001 From: James Khan Date: Sat, 11 May 2019 20:17:05 +0100 Subject: [PATCH] Translate JoystickState directly from LWJGL context. Set the logger to the correct class --- .../main/java/com/jme3/system/lwjgl/LwjglContext.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/jme3-lwjgl3/src/main/java/com/jme3/system/lwjgl/LwjglContext.java b/jme3-lwjgl3/src/main/java/com/jme3/system/lwjgl/LwjglContext.java index c3a83edeb..2606c7fdd 100644 --- a/jme3-lwjgl3/src/main/java/com/jme3/system/lwjgl/LwjglContext.java +++ b/jme3-lwjgl3/src/main/java/com/jme3/system/lwjgl/LwjglContext.java @@ -37,6 +37,8 @@ import static java.util.stream.Collectors.toSet; import static org.lwjgl.opencl.CL10.CL_CONTEXT_PLATFORM; import static org.lwjgl.opengl.GL.createCapabilities; import static org.lwjgl.opengl.GL11.glGetInteger; + +import com.jme3.input.JoystickState; import com.jme3.input.lwjgl.GlfwJoystickInput; import com.jme3.input.lwjgl.GlfwKeyInput; import com.jme3.input.lwjgl.GlfwMouseInput; @@ -238,7 +240,12 @@ public abstract class LwjglContext implements JmeContext { @Override public void invoke(int jid, int event) { joyInput.reloadJoysticks(); - joyInput.fireJoystickConnectionEvent(jid, event); + + JoystickState state = event == GLFW.GLFW_CONNECTED + ? JoystickState.Connected + : JoystickState.Disconnected; + + joyInput.fireJoystickConnectionEvent(jid, state); } });