diff --git a/src/main/java/eu/midnightdust/midnightcontrols/client/MidnightControlsConfig.java b/src/main/java/eu/midnightdust/midnightcontrols/client/MidnightControlsConfig.java index b823509..3b7b83b 100644 --- a/src/main/java/eu/midnightdust/midnightcontrols/client/MidnightControlsConfig.java +++ b/src/main/java/eu/midnightdust/midnightcontrols/client/MidnightControlsConfig.java @@ -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; diff --git a/src/main/java/eu/midnightdust/midnightcontrols/client/gui/MidnightControlsHud.java b/src/main/java/eu/midnightdust/midnightcontrols/client/gui/MidnightControlsHud.java index 1153ee2..a596c3b 100644 --- a/src/main/java/eu/midnightdust/midnightcontrols/client/gui/MidnightControlsHud.java +++ b/src/main/java/eu/midnightdust/midnightcontrols/client/gui/MidnightControlsHud.java @@ -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()) { diff --git a/src/main/java/eu/midnightdust/midnightcontrols/client/gui/MidnightControlsSettingsScreen.java b/src/main/java/eu/midnightdust/midnightcontrols/client/gui/MidnightControlsSettingsScreen.java index 4e3ab21..7fff583 100644 --- a/src/main/java/eu/midnightdust/midnightcontrols/client/gui/MidnightControlsSettingsScreen.java +++ b/src/main/java/eu/midnightdust/midnightcontrols/client/gui/MidnightControlsSettingsScreen.java @@ -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; } diff --git a/src/main/resources/assets/midnightcontrols/lang/en_us.json b/src/main/resources/assets/midnightcontrols/lang/en_us.json index 5ccbb06..dba1ccb 100644 --- a/src/main/resources/assets/midnightcontrols/lang/en_us.json +++ b/src/main/resources/assets/midnightcontrols/lang/en_us.json @@ -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.",