Added an option to always show the HUD while in Controller Mode, matching the legacy behaviour of LambdaControls. This option is enabled by default so that users migrating from LambdaControls will have a consistent experience.

This commit is contained in:
Karen/あけみ
2022-05-03 04:53:45 -07:00
parent 78c858b753
commit 1a0030a680
4 changed files with 15 additions and 6 deletions

View File

@@ -35,6 +35,7 @@ public class MidnightControlsConfig extends MidnightConfig {
@Entry public static boolean debug = false;
// HUD
@Entry public static boolean hudEnable = true;
@Entry public static boolean hudAlwaysShow = true; // Enabled by default so that users migrating from LambdaControls will have a consistent experience.
@Entry public static HudSide hudSide = HudSide.LEFT;
// Gameplay
@Entry public static boolean analogMovement = true;

View File

@@ -78,12 +78,14 @@ public class MidnightControlsHud extends Hud {
*/
@Override
public void render(MatrixStack matrices, float tickDelta) {
if (MidnightControlsConfig.controlsMode == ControlsMode.CONTROLLER && this.client.currentScreen == null && MidnightControlsConfig.getController().isConnected() && MidnightControlsConfig.getController().isGamepad()) {
int y = bottom(2);
this.renderFirstIcons(matrices, MidnightControlsConfig.hudSide == HudSide.LEFT ? 2 : client.getWindow().getScaledWidth() - 2, y);
this.renderSecondIcons(matrices, MidnightControlsConfig.hudSide == HudSide.RIGHT ? 2 : client.getWindow().getScaledWidth() - 2, y);
this.renderFirstSection(matrices, MidnightControlsConfig.hudSide == HudSide.LEFT ? 2 : client.getWindow().getScaledWidth() - 2, y);
this.renderSecondSection(matrices, MidnightControlsConfig.hudSide == HudSide.RIGHT ? 2 : client.getWindow().getScaledWidth() - 2, y);
if (MidnightControlsConfig.controlsMode == ControlsMode.CONTROLLER && this.client.currentScreen == null) {
if (MidnightControlsConfig.hudAlwaysShow || (MidnightControlsConfig.getController().isConnected() && MidnightControlsConfig.getController().isGamepad())) {
int y = bottom(2);
this.renderFirstIcons(matrices, MidnightControlsConfig.hudSide == HudSide.LEFT ? 2 : client.getWindow().getScaledWidth() - 2, y);
this.renderSecondIcons(matrices, MidnightControlsConfig.hudSide == HudSide.RIGHT ? 2 : client.getWindow().getScaledWidth() - 2, y);
this.renderFirstSection(matrices, MidnightControlsConfig.hudSide == HudSide.LEFT ? 2 : client.getWindow().getScaledWidth() - 2, y);
this.renderSecondSection(matrices, MidnightControlsConfig.hudSide == HudSide.RIGHT ? 2 : client.getWindow().getScaledWidth() - 2, y);
}
}
if (this.mod.reacharound.isLastReacharoundVertical()) {

View File

@@ -72,6 +72,7 @@ public class MidnightControlsSettingsScreen extends SpruceScreen {
private final SpruceOption controllerTypeOption;
private final SpruceOption virtualMouseSkinOption;
private final SpruceOption hudEnableOption;
private final SpruceOption hudAlwaysShowOption;
private final SpruceOption hudSideOption;
// Controller options
private final SpruceOption controllerOption =
@@ -212,6 +213,8 @@ public class MidnightControlsSettingsScreen extends SpruceScreen {
null);
this.hudEnableOption = new SpruceToggleBooleanOption("midnightcontrols.menu.hud_enable", () -> MidnightControlsConfig.hudEnable,
this.mod::setHudEnabled, new TranslatableText("midnightcontrols.tooltip.hud_enable"));
this.hudAlwaysShowOption = new SpruceToggleBooleanOption("midnightcontrols.menu.hud_always_show", () -> MidnightControlsConfig.hudAlwaysShow,
value -> MidnightControlsConfig.hudAlwaysShow = value, new TranslatableText("midnightcontrols.tooltip.hud_always_show"));
this.hudSideOption = new SpruceCyclingOption("midnightcontrols.menu.hud_side",
amount -> MidnightControlsConfig.hudSide = MidnightControlsConfig.hudSide.next(),
option -> option.getDisplayText(MidnightControlsConfig.hudSide.getTranslatedText()),
@@ -320,6 +323,7 @@ public class MidnightControlsSettingsScreen extends SpruceScreen {
list.addSingleOptionEntry(this.virtualMouseSkinOption);
list.addSingleOptionEntry(new SpruceSeparatorOption("midnightcontrols.menu.title.hud", true, null));
list.addSingleOptionEntry(this.hudEnableOption);
list.addSingleOptionEntry(this.hudAlwaysShowOption);
list.addSingleOptionEntry(this.hudSideOption);
return list;
}

View File

@@ -96,6 +96,7 @@
"midnightcontrols.menu.fly_drifting": "Fly Drifting",
"midnightcontrols.menu.fly_drifting_vertical": "Vertical Fly Drifting",
"midnightcontrols.menu.hud_enable": "Enable HUD",
"midnightcontrols.menu.hud_always_show": "Always Show HUD When in Controller Mode",
"midnightcontrols.menu.hud_side": "HUD Side",
"midnightcontrols.menu.invert_right_x_axis": "Invert Right X",
"midnightcontrols.menu.invert_right_y_axis": "Invert Right Y",
@@ -136,6 +137,7 @@
"midnightcontrols.tooltip.fly_drifting": "While flying, enables Vanilla drifting/inertia.",
"midnightcontrols.tooltip.fly_drifting_vertical": "While flying, enables Vanilla vertical drifting/intertia.",
"midnightcontrols.tooltip.hud_enable": "Toggles the on-screen controller button indicator.",
"midnightcontrols.tooltip.hud_always_show": "Toggles whether or not to always show the HUD when in Controller Mode, regardless of whether or not a controller is actually connected.",
"midnightcontrols.tooltip.hud_side": "The position of the HUD.",
"midnightcontrols.tooltip.left_dead_zone": "The dead zone for the controller's left analogue stick.",
"midnightcontrols.tooltip.max_left_x_value": "Changes what the mod considers the highest value for the left X axis. Useful if your axis does not use the full range and seems slow.",