aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/cc/polyfrost/oneconfig/gui
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/cc/polyfrost/oneconfig/gui')
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/gui/HudGui.java8
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/gui/OneConfigGui.java4
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/gui/SideBar.java2
3 files changed, 12 insertions, 2 deletions
diff --git a/src/main/java/cc/polyfrost/oneconfig/gui/HudGui.java b/src/main/java/cc/polyfrost/oneconfig/gui/HudGui.java
index b45a1d8..f5b1d3f 100644
--- a/src/main/java/cc/polyfrost/oneconfig/gui/HudGui.java
+++ b/src/main/java/cc/polyfrost/oneconfig/gui/HudGui.java
@@ -8,6 +8,7 @@ import cc.polyfrost.oneconfig.renderer.RenderManager;
import cc.polyfrost.oneconfig.libs.universal.UKeyboard;
import cc.polyfrost.oneconfig.libs.universal.UMatrixStack;
import cc.polyfrost.oneconfig.libs.universal.UScreen;
+import cc.polyfrost.oneconfig.utils.gui.GuiUtils;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -18,9 +19,15 @@ public class HudGui extends UScreen implements GuiPause {
private Hud editingHud;
private boolean isDragging;
private boolean isScaling;
+ private final boolean openOneConfigOnClose;
private int xOffset;
private int yOffset;
+ public HudGui(boolean openOneConfigOnClose) {
+ super();
+ this.openOneConfigOnClose = openOneConfigOnClose;
+ }
+
@Override
public void initScreen(int width, int height) {
HudCore.editing = true;
@@ -275,6 +282,7 @@ public class HudGui extends UScreen implements GuiPause {
HudCore.editing = false;
UKeyboard.allowRepeatEvents(false);
ConfigCore.saveAll();
+ if(openOneConfigOnClose) GuiUtils.displayScreen(OneConfigGui.create());
}
@Override
diff --git a/src/main/java/cc/polyfrost/oneconfig/gui/OneConfigGui.java b/src/main/java/cc/polyfrost/oneconfig/gui/OneConfigGui.java
index 35946e0..1095ae0 100644
--- a/src/main/java/cc/polyfrost/oneconfig/gui/OneConfigGui.java
+++ b/src/main/java/cc/polyfrost/oneconfig/gui/OneConfigGui.java
@@ -188,7 +188,9 @@ public class OneConfigGui extends UScreen implements GuiPause {
public void onKeyPressed(int keyCode, char typedChar, @Nullable UKeyboard.Modifiers modifiers) {
UKeyboard.allowRepeatEvents(true);
try {
- if (allowClose) super.onKeyPressed(keyCode, typedChar, modifiers);
+ if (keyCode == 1 && currentPage.parents.size() > 1) {
+ openPage(currentPage.parents.get(currentPage.parents.size() - 2));
+ } else if (allowClose) super.onKeyPressed(keyCode, typedChar, modifiers);
textInputField.keyTyped(typedChar, keyCode);
if (currentColorSelector != null) currentColorSelector.keyTyped(typedChar, keyCode);
currentPage.keyTyped(typedChar, keyCode);
diff --git a/src/main/java/cc/polyfrost/oneconfig/gui/SideBar.java b/src/main/java/cc/polyfrost/oneconfig/gui/SideBar.java
index df3330d..d1b5532 100644
--- a/src/main/java/cc/polyfrost/oneconfig/gui/SideBar.java
+++ b/src/main/java/cc/polyfrost/oneconfig/gui/SideBar.java
@@ -43,7 +43,7 @@ public class SideBar {
buttons.get(0).setClickAction(new CreditsPage());
buttons.get(2).setClickAction(new ModsPage());
buttons.get(8).setClickAction(new ModConfigPage(Preferences.getInstance().mod.defaultPage, true));
- HUDButton.setClickAction(() -> GuiUtils.displayScreen(new HudGui()));
+ HUDButton.setClickAction(() -> GuiUtils.displayScreen(new HudGui(true)));
CloseButton.setClickAction(GuiUtils::closeScreen);
for (BasicButton button : buttons) {
if (button.hasClickAction()) continue;