Skip to content

Commit 2f6185b

Browse files
committed
Remove JoystickState enum and replace with boolean value.
1 parent d3be2f3 commit 2f6185b

File tree

5 files changed

+9
-25
lines changed

5 files changed

+9
-25
lines changed

jme3-core/src/main/java/com/jme3/input/InputManager.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -995,11 +995,11 @@ public void clearJoystickConnectionListeners() {
995995
* Called when a joystick has been added or removed.
996996
* This should only be called internally.
997997
* @param joystickId the ID of the joystick.
998-
* @param state the state that occured (connected / disconnected).
998+
* @param connected the connection state of the joystick.
999999
*/
1000-
public void fireJoystickConnectionEvent(int joystickId, JoystickState state) {
1000+
public void fireJoystickConnectionEvent(int joystickId, boolean connected) {
10011001
for (JoystickConnectionListener listener : joystickConnectionListeners) {
1002-
listener.connectionChanged(joystickId, state);
1002+
listener.connectionChanged(joystickId, connected);
10031003
}
10041004
}
10051005

jme3-core/src/main/java/com/jme3/input/JoystickConnectionListener.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22

33
public interface JoystickConnectionListener {
44

5-
void connectionChanged(int joystickId, JoystickState action);
5+
void connectionChanged(int joystickId, boolean connected);
66

77
}

jme3-core/src/main/java/com/jme3/input/JoystickState.java

Lines changed: 0 additions & 12 deletions
This file was deleted.

jme3-lwjgl3/src/main/java/com/jme3/input/lwjgl/GlfwJoystickInput.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,8 @@ public void setJoyRumble(final int joyId, final float amount) {
6868
}
6969
}
7070

71-
public void fireJoystickConnectionEvent(int jid, JoystickState state) {
72-
((InputManager)listener).fireJoystickConnectionEvent(jid, state);
71+
public void fireJoystickConnectionEvent(int jid, boolean connected) {
72+
((InputManager)listener).fireJoystickConnectionEvent(jid, connected);
7373
}
7474

7575
public void reloadJoysticks() {

jme3-lwjgl3/src/main/java/com/jme3/system/lwjgl/LwjglContext.java

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@
3838
import static org.lwjgl.opengl.GL.createCapabilities;
3939
import static org.lwjgl.opengl.GL11.glGetInteger;
4040

41-
import com.jme3.input.JoystickState;
4241
import com.jme3.input.lwjgl.GlfwJoystickInput;
4342
import com.jme3.input.lwjgl.GlfwKeyInput;
4443
import com.jme3.input.lwjgl.GlfwMouseInput;
@@ -239,13 +238,10 @@ protected void initContextFirstTime() {
239238
GLFW.glfwSetJoystickCallback(new GLFWJoystickCallback() {
240239
@Override
241240
public void invoke(int jid, int event) {
242-
joyInput.reloadJoysticks();
243-
244-
JoystickState state = event == GLFW.GLFW_CONNECTED
245-
? JoystickState.Connected
246-
: JoystickState.Disconnected;
247241

248-
joyInput.fireJoystickConnectionEvent(jid, state);
242+
// fire the event after joysticks were reloaded.
243+
joyInput.reloadJoysticks();
244+
joyInput.fireJoystickConnectionEvent(jid, event == GLFW.GLFW_CONNECTED);
249245
}
250246
});
251247

0 commit comments

Comments
 (0)