mirror of
https://github.com/moonlight-stream/moonlight-embedded.git
synced 2026-02-16 10:30:47 +00:00
changed a poorly named variable
This commit is contained in:
@@ -116,7 +116,7 @@ public class GamepadConfigFrame extends JFrame {
|
||||
mapButton.setPreferredSize(buttonSize);
|
||||
mapButton.addActionListener(createMapListener());
|
||||
|
||||
setButtonText(mapButton, config.getMapping(mapping.contComp));
|
||||
setButtonText(mapButton, config.getMapping(mapping.padComp));
|
||||
|
||||
invertBox.setSelected(mapping.invert);
|
||||
invertBox.addItemListener(createInvertListener());
|
||||
@@ -126,7 +126,7 @@ public class GamepadConfigFrame extends JFrame {
|
||||
triggerBox.setToolTipText("If this component should act as a trigger. (one-way axis)");
|
||||
|
||||
componentBox.add(Box.createHorizontalStrut(5));
|
||||
componentBox.add(mapping.contComp.getLabel());
|
||||
componentBox.add(mapping.padComp.getLabel());
|
||||
componentBox.add(Box.createHorizontalGlue());
|
||||
componentBox.add(mapButton);
|
||||
componentBox.add(invertBox);
|
||||
@@ -149,8 +149,8 @@ public class GamepadConfigFrame extends JFrame {
|
||||
@Override
|
||||
public void itemStateChanged(ItemEvent e) {
|
||||
JCheckBox clicked = (JCheckBox)e.getItem();
|
||||
GamepadComponent contComp = GamepadComponent.valueOf(clicked.getName());
|
||||
config.get(contComp).invert = (e.getStateChange() == ItemEvent.SELECTED);
|
||||
GamepadComponent padComp = GamepadComponent.valueOf(clicked.getName());
|
||||
config.get(padComp).invert = (e.getStateChange() == ItemEvent.SELECTED);
|
||||
configChanged = true;
|
||||
}
|
||||
};
|
||||
@@ -164,8 +164,8 @@ public class GamepadConfigFrame extends JFrame {
|
||||
@Override
|
||||
public void itemStateChanged(ItemEvent e) {
|
||||
JCheckBox clicked = (JCheckBox)e.getItem();
|
||||
GamepadComponent contComp = GamepadComponent.valueOf(clicked.getName());
|
||||
config.get(contComp).trigger = (e.getStateChange() == ItemEvent.SELECTED);
|
||||
GamepadComponent padComp = GamepadComponent.valueOf(clicked.getName());
|
||||
config.get(padComp).trigger = (e.getStateChange() == ItemEvent.SELECTED);
|
||||
configChanged = true;
|
||||
}
|
||||
};
|
||||
@@ -284,7 +284,7 @@ public class GamepadConfigFrame extends JFrame {
|
||||
try {
|
||||
Thread.sleep(100);
|
||||
} catch (InterruptedException e) {
|
||||
setButtonText(buttonPressed, config.getMapping(mappingToMap.contComp));
|
||||
setButtonText(buttonPressed, config.getMapping(mappingToMap.padComp));
|
||||
GamepadListener.getInstance().removeListener(this);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -46,13 +46,13 @@ public class Gamepad implements DeviceListener {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!mapped.contComp.isAnalog()) {
|
||||
if (!mapped.padComp.isAnalog()) {
|
||||
handleDigitalComponent(mapped, pressed);
|
||||
} else {
|
||||
handleAnalogComponent(mapped.contComp, sanitizeValue(mapped, pressed));
|
||||
handleAnalogComponent(mapped.padComp, sanitizeValue(mapped, pressed));
|
||||
}
|
||||
|
||||
//printInfo(device, new SourceComponent(Type.BUTTON, buttonId), mapped.contComp, pressed ? 1F : 0F);
|
||||
//printInfo(device, new SourceComponent(Type.BUTTON, buttonId), mapped.padComp, pressed ? 1F : 0F);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -67,13 +67,13 @@ public class Gamepad implements DeviceListener {
|
||||
|
||||
float value = sanitizeValue(mapped, newValue);
|
||||
|
||||
if (mapped.contComp.isAnalog()) {
|
||||
handleAnalogComponent(mapped.contComp, value);
|
||||
if (mapped.padComp.isAnalog()) {
|
||||
handleAnalogComponent(mapped.padComp, value);
|
||||
} else {
|
||||
handleDigitalComponent(mapped, (value > 0.5));
|
||||
}
|
||||
|
||||
//printInfo(device, new SourceComponent(Type.AXIS, axisId), mapped.contComp, newValue);
|
||||
//printInfo(device, new SourceComponent(Type.AXIS, axisId), mapped.padComp, newValue);
|
||||
}
|
||||
|
||||
private float sanitizeValue(Mapping mapped, boolean value) {
|
||||
@@ -123,7 +123,7 @@ public class Gamepad implements DeviceListener {
|
||||
|
||||
|
||||
private void handleDigitalComponent(Mapping mapped, boolean pressed) {
|
||||
switch (mapped.contComp) {
|
||||
switch (mapped.padComp) {
|
||||
case BTN_A:
|
||||
toggle(ControllerPacket.A_FLAG, pressed);
|
||||
break;
|
||||
@@ -170,7 +170,7 @@ public class Gamepad implements DeviceListener {
|
||||
toggle(ControllerPacket.SPECIAL_BUTTON_FLAG, pressed);
|
||||
break;
|
||||
default:
|
||||
System.out.println("A mapping error has occured. Ignoring: " + mapped.contComp.name());
|
||||
System.out.println("A mapping error has occured. Ignoring: " + mapped.padComp.name());
|
||||
return;
|
||||
}
|
||||
if (conn != null) {
|
||||
|
||||
@@ -49,13 +49,13 @@ public class GamepadMapping implements Serializable {
|
||||
/**
|
||||
* Gets the mapped ControllerComponent for the specified ControllerComponent.</br>
|
||||
* <b>NOTE: Iterates a hashmap, use sparingly</b>
|
||||
* @param contComp the component to get a mapping for
|
||||
* @param padComp the component to get a mapping for
|
||||
* @return a mapping or an null if there is none
|
||||
*/
|
||||
public Mapping get(GamepadComponent contComp) {
|
||||
public Mapping get(GamepadComponent padComp) {
|
||||
//#allTheJank
|
||||
for (Entry<SourceComponent, Mapping> entry : mapping.entrySet()) {
|
||||
if (entry.getValue().contComp == contComp) {
|
||||
if (entry.getValue().padComp == padComp) {
|
||||
return entry.getValue();
|
||||
}
|
||||
}
|
||||
@@ -65,12 +65,12 @@ public class GamepadMapping implements Serializable {
|
||||
/**
|
||||
* Gets the mapping for the specified component.</br>
|
||||
* <b>NOTE: Iterates a hashmap, use sparingly</b>
|
||||
* @param contComp the component to get a mapping for
|
||||
* @param padComp the component to get a mapping for
|
||||
* @return a mapping or an empty string if there is none
|
||||
*/
|
||||
public SourceComponent getMapping(GamepadComponent contComp) {
|
||||
public SourceComponent getMapping(GamepadComponent padComp) {
|
||||
for (Entry<SourceComponent, Mapping> entry : mapping.entrySet()) {
|
||||
if (entry.getValue().contComp == contComp) {
|
||||
if (entry.getValue().padComp == padComp) {
|
||||
return entry.getKey();
|
||||
}
|
||||
}
|
||||
@@ -87,7 +87,7 @@ public class GamepadMapping implements Serializable {
|
||||
/**
|
||||
* The component this mapping belongs to
|
||||
*/
|
||||
public GamepadComponent contComp;
|
||||
public GamepadComponent padComp;
|
||||
|
||||
/**
|
||||
* Whether the value of this component should be inverted
|
||||
@@ -101,12 +101,12 @@ public class GamepadMapping implements Serializable {
|
||||
|
||||
/**
|
||||
* Constructs a new mapping with the specified configuration
|
||||
* @param contComp the component this mapping belongs to
|
||||
* @param padComp the component this mapping belongs to
|
||||
* @param invert whether the value should be inverted
|
||||
* @param trigger whether this component should be treated as a trigger
|
||||
*/
|
||||
public Mapping(GamepadComponent contComp, boolean invert, boolean trigger) {
|
||||
this.contComp = contComp;
|
||||
public Mapping(GamepadComponent padComp, boolean invert, boolean trigger) {
|
||||
this.padComp = padComp;
|
||||
this.invert = invert;
|
||||
this.trigger = trigger;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user