Skip to content

Commit 76fcc2c

Browse files
committed
Remove magic number translations and remove uppercase names.
1 parent 682d8c9 commit 76fcc2c

File tree

1 file changed

+2
-37
lines changed

1 file changed

+2
-37
lines changed

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

Lines changed: 2 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -6,42 +6,7 @@
66
*/
77
public enum JoystickState {
88

9-
// a list of connected/disconnected codes from various contexts.
10-
11-
// using the JoystickState.fromCode(int) method, if the code matches
12-
// it will return the enum value.
13-
14-
CONNECTED(new int[] {
15-
0x40001 // GLFW.GLFW_CONNECTED / LWJGL3
16-
}),
17-
18-
DISCONNECTED(new int[] {
19-
0x40002 // GLFW.GLFW_DISCONNECTED / LWJGL3
20-
}),
21-
22-
UNKNOWN(new int[0]);
23-
24-
private int[] codes;
25-
26-
JoystickState(int[] codes) {
27-
this.codes = codes;
28-
}
29-
30-
private int[] getCodes() {
31-
return codes;
32-
}
33-
34-
public static JoystickState fromCode(int value) {
35-
36-
for (JoystickState state : values()) {
37-
for (int code : state.getCodes()) {
38-
if (value == code) {
39-
return state;
40-
}
41-
}
42-
}
43-
44-
return UNKNOWN;
45-
}
9+
Connected,
10+
Disconnected,
4611

4712
}

0 commit comments

Comments
 (0)