Remove JoystickState enum and replace with boolean value.
This commit is contained in:
parent
d3be2f332f
commit
2f6185b5cf
@ -995,11 +995,11 @@ public class InputManager implements RawInputListener {
|
|||||||
* Called when a joystick has been added or removed.
|
* Called when a joystick has been added or removed.
|
||||||
* This should only be called internally.
|
* This should only be called internally.
|
||||||
* @param joystickId the ID of the joystick.
|
* @param joystickId the ID of the joystick.
|
||||||
* @param state the state that occured (connected / disconnected).
|
* @param connected the connection state of the joystick.
|
||||||
*/
|
*/
|
||||||
public void fireJoystickConnectionEvent(int joystickId, JoystickState state) {
|
public void fireJoystickConnectionEvent(int joystickId, boolean connected) {
|
||||||
for (JoystickConnectionListener listener : joystickConnectionListeners) {
|
for (JoystickConnectionListener listener : joystickConnectionListeners) {
|
||||||
listener.connectionChanged(joystickId, state);
|
listener.connectionChanged(joystickId, connected);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,6 +2,6 @@ package com.jme3.input;
|
|||||||
|
|
||||||
public interface JoystickConnectionListener {
|
public interface JoystickConnectionListener {
|
||||||
|
|
||||||
void connectionChanged(int joystickId, JoystickState action);
|
void connectionChanged(int joystickId, boolean connected);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,12 +0,0 @@
|
|||||||
package com.jme3.input;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Response for joystick callback events.
|
|
||||||
* @author jayfella
|
|
||||||
*/
|
|
||||||
public enum JoystickState {
|
|
||||||
|
|
||||||
Connected,
|
|
||||||
Disconnected,
|
|
||||||
|
|
||||||
}
|
|
@ -68,8 +68,8 @@ public class GlfwJoystickInput implements JoyInput {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void fireJoystickConnectionEvent(int jid, JoystickState state) {
|
public void fireJoystickConnectionEvent(int jid, boolean connected) {
|
||||||
((InputManager)listener).fireJoystickConnectionEvent(jid, state);
|
((InputManager)listener).fireJoystickConnectionEvent(jid, connected);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void reloadJoysticks() {
|
public void reloadJoysticks() {
|
||||||
|
@ -38,7 +38,6 @@ import static org.lwjgl.opencl.CL10.CL_CONTEXT_PLATFORM;
|
|||||||
import static org.lwjgl.opengl.GL.createCapabilities;
|
import static org.lwjgl.opengl.GL.createCapabilities;
|
||||||
import static org.lwjgl.opengl.GL11.glGetInteger;
|
import static org.lwjgl.opengl.GL11.glGetInteger;
|
||||||
|
|
||||||
import com.jme3.input.JoystickState;
|
|
||||||
import com.jme3.input.lwjgl.GlfwJoystickInput;
|
import com.jme3.input.lwjgl.GlfwJoystickInput;
|
||||||
import com.jme3.input.lwjgl.GlfwKeyInput;
|
import com.jme3.input.lwjgl.GlfwKeyInput;
|
||||||
import com.jme3.input.lwjgl.GlfwMouseInput;
|
import com.jme3.input.lwjgl.GlfwMouseInput;
|
||||||
@ -239,13 +238,10 @@ public abstract class LwjglContext implements JmeContext {
|
|||||||
GLFW.glfwSetJoystickCallback(new GLFWJoystickCallback() {
|
GLFW.glfwSetJoystickCallback(new GLFWJoystickCallback() {
|
||||||
@Override
|
@Override
|
||||||
public void invoke(int jid, int event) {
|
public void invoke(int jid, int event) {
|
||||||
|
|
||||||
|
// fire the event after joysticks were reloaded.
|
||||||
joyInput.reloadJoysticks();
|
joyInput.reloadJoysticks();
|
||||||
|
joyInput.fireJoystickConnectionEvent(jid, event == GLFW.GLFW_CONNECTED);
|
||||||
JoystickState state = event == GLFW.GLFW_CONNECTED
|
|
||||||
? JoystickState.Connected
|
|
||||||
: JoystickState.Disconnected;
|
|
||||||
|
|
||||||
joyInput.fireJoystickConnectionEvent(jid, state);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user