Access the Type enum through SourceComponent. Check the absolute value of the new value so negative works too.

This commit is contained in:
Cameron Gutman
2013-12-30 23:29:33 -06:00
parent d8b3cc98c8
commit 524a2b2a5e

View File

@@ -30,7 +30,6 @@ import com.limelight.input.gamepad.GamepadListener;
import com.limelight.input.gamepad.GamepadMapping; import com.limelight.input.gamepad.GamepadMapping;
import com.limelight.input.gamepad.GamepadMapping.Mapping; import com.limelight.input.gamepad.GamepadMapping.Mapping;
import com.limelight.input.gamepad.SourceComponent; import com.limelight.input.gamepad.SourceComponent;
import com.limelight.input.gamepad.SourceComponent.Type;
import com.limelight.settings.GamepadSettingsManager; import com.limelight.settings.GamepadSettingsManager;
/** /**
@@ -311,15 +310,15 @@ public class GamepadConfigFrame extends JFrame {
@Override @Override
public void handleButton(Device device, int buttonId, boolean pressed) { public void handleButton(Device device, int buttonId, boolean pressed) {
if (pressed) { if (pressed) {
newMapping = new SourceComponent(Type.BUTTON, buttonId); newMapping = new SourceComponent(SourceComponent.Type.BUTTON, buttonId);
} }
} }
@Override @Override
public void handleAxis(Device device, int axisId, float newValue, public void handleAxis(Device device, int axisId, float newValue,
float lastValue) { float lastValue) {
if (newValue > 0.75) { if (Math.abs(newValue) > 0.75) {
newMapping = new SourceComponent(Type.AXIS, axisId); newMapping = new SourceComponent(SourceComponent.Type.AXIS, axisId);
} }
} }