diff options
author | nextdaydelivery <79922345+nxtdaydelivery@users.noreply.github.com> | 2022-07-03 10:57:19 +0100 |
---|---|---|
committer | nextdaydelivery <79922345+nxtdaydelivery@users.noreply.github.com> | 2022-07-03 10:57:19 +0100 |
commit | 52d921c208d87b71665ff78cea88b37a44a29cae (patch) | |
tree | e3626f139fd8ce71523a3e4f475d661e9af4ff1d /src/main/java/cc/polyfrost/oneconfig/gui | |
parent | 1e285b84ec8dace3331b11dfa5b10a8af6cd8354 (diff) | |
download | OneConfig-52d921c208d87b71665ff78cea88b37a44a29cae.tar.gz OneConfig-52d921c208d87b71665ff78cea88b37a44a29cae.tar.bz2 OneConfig-52d921c208d87b71665ff78cea88b37a44a29cae.zip |
changes to ESC behavior
Diffstat (limited to 'src/main/java/cc/polyfrost/oneconfig/gui')
-rw-r--r-- | src/main/java/cc/polyfrost/oneconfig/gui/HudGui.java | 8 | ||||
-rw-r--r-- | src/main/java/cc/polyfrost/oneconfig/gui/OneConfigGui.java | 4 | ||||
-rw-r--r-- | src/main/java/cc/polyfrost/oneconfig/gui/SideBar.java | 2 |
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; |