API hooks for movement and screen pages

This commit is contained in:
Martin Prokoph
2024-07-22 15:23:20 +02:00
parent 540920009f
commit a55e506af0
8 changed files with 96 additions and 45 deletions

View File

@@ -288,7 +288,7 @@ public class MidnightInput {
float rightX = polarUtil.polarX;
float rightY = polarUtil.polarY;
boolean isRadialMenu = client.currentScreen instanceof RingScreen || (MidnightControlsCompat.isEmotecraftPresent() && EmotecraftCompat.isEmotecraftScreen(client.currentScreen));
boolean isRadialMenu = client.currentScreen instanceof RingScreen || (EmotecraftCompat.isPresent() && EmotecraftCompat.isEmotecraftScreen(client.currentScreen));
if (!isRadialMenu) {
for (int i = 0; i < GLFW_GAMEPAD_AXIS_LEFT_TRIGGER; i++) {
@@ -505,8 +505,10 @@ public class MidnightInput {
}
axisValue = (float) Math.min(axisValue / MidnightControlsConfig.getAxisMaxValue(storage.axis), 1);
InputManager.BUTTON_VALUES.put(ButtonBinding.axisAsButton(storage.axis, true), storage.polarity == AxisStorage.Polarity.PLUS ? axisValue : 0.f);
InputManager.BUTTON_VALUES.put(ButtonBinding.axisAsButton(storage.axis, false), storage.polarity == AxisStorage.Polarity.MINUS ? axisValue : 0.f);
if (!MidnightControlsCompat.handleMovement(storage, axisValue)) {
InputManager.BUTTON_VALUES.put(ButtonBinding.axisAsButton(storage.axis, true), storage.polarity == AxisStorage.Polarity.PLUS ? axisValue : 0.f);
InputManager.BUTTON_VALUES.put(ButtonBinding.axisAsButton(storage.axis, false), storage.polarity == AxisStorage.Polarity.MINUS ? axisValue : 0.f);
}
}
private boolean handleScreenScrolling(Screen screen, AxisStorage storage) {
@@ -585,7 +587,7 @@ public class MidnightInput {
else if (y > border) index = 6;
}
if (client.currentScreen instanceof RingScreen && index > -1) RingPage.selected = index;
if (MidnightControlsCompat.isEmotecraftPresent() && EmotecraftCompat.isEmotecraftScreen(client.currentScreen)) EmotecraftCompat.handleEmoteSelector(index);
if (EmotecraftCompat.isPresent() && EmotecraftCompat.isEmotecraftScreen(client.currentScreen)) EmotecraftCompat.handleEmoteSelector(index);
}
public boolean handleListWidgetScrolling(List<? extends Element> children, float value) {