diff options
author | DeDiamondPro <67508414+DeDiamondPro@users.noreply.github.com> | 2022-08-17 17:43:23 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-08-17 17:43:23 +0200 |
commit | 97f788ecd4be15b1556ee1f3d8bd057bdf06bf5f (patch) | |
tree | 2bccc96007025fbccf1758ac66d4665a97d6c315 /versions/src/main/java/cc/polyfrost/oneconfig/utils/gui | |
parent | e18629af6aee276b0be6cec473e4099cca9100f1 (diff) | |
download | OneConfig-97f788ecd4be15b1556ee1f3d8bd057bdf06bf5f.tar.gz OneConfig-97f788ecd4be15b1556ee1f3d8bd057bdf06bf5f.tar.bz2 OneConfig-97f788ecd4be15b1556ee1f3d8bd057bdf06bf5f.zip |
Input revamp (#93)
* hud fix
* api
* things
* stuff
Diffstat (limited to 'versions/src/main/java/cc/polyfrost/oneconfig/utils/gui')
-rw-r--r-- | versions/src/main/java/cc/polyfrost/oneconfig/utils/gui/GuiUtils.java | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/versions/src/main/java/cc/polyfrost/oneconfig/utils/gui/GuiUtils.java b/versions/src/main/java/cc/polyfrost/oneconfig/utils/gui/GuiUtils.java index bda5b2f..96b5866 100644 --- a/versions/src/main/java/cc/polyfrost/oneconfig/utils/gui/GuiUtils.java +++ b/versions/src/main/java/cc/polyfrost/oneconfig/utils/gui/GuiUtils.java @@ -33,6 +33,7 @@ import cc.polyfrost.oneconfig.gui.OneConfigGui; import cc.polyfrost.oneconfig.libs.eventbus.Subscribe; import cc.polyfrost.oneconfig.libs.universal.UMinecraft; import cc.polyfrost.oneconfig.libs.universal.UScreen; +import cc.polyfrost.oneconfig.platform.Platform; import cc.polyfrost.oneconfig.utils.TickDelay; import net.minecraft.client.gui.GuiScreen; @@ -46,6 +47,7 @@ import java.util.concurrent.ConcurrentLinkedDeque; public final class GuiUtils { private static long time = -1L; private static long deltaTime = 17L; + private static boolean wasMouseDown = false; private static final Deque<Optional<GuiScreen>> screenQueue = new ConcurrentLinkedDeque<>(); static { @@ -112,6 +114,13 @@ public final class GuiUtils { return deltaTime; } + /** + * @return If the mouse was down last frame + */ + public static boolean wasMouseDown() { + return wasMouseDown; + } + @Subscribe private void onRenderEvent(RenderEvent event) { if (event.stage == Stage.START) { @@ -121,6 +130,8 @@ public final class GuiUtils { deltaTime = currentTime - time; time = currentTime; } + } else if (event.stage == Stage.END) { + wasMouseDown = Platform.getMousePlatform().isButtonDown(0); } } } |