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 /src/main/java/cc/polyfrost/oneconfig/utils/gui/GuiUtils.java | |
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 'src/main/java/cc/polyfrost/oneconfig/utils/gui/GuiUtils.java')
-rw-r--r-- | src/main/java/cc/polyfrost/oneconfig/utils/gui/GuiUtils.java | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/main/java/cc/polyfrost/oneconfig/utils/gui/GuiUtils.java b/src/main/java/cc/polyfrost/oneconfig/utils/gui/GuiUtils.java index e3dffb6..71bba26 100644 --- a/src/main/java/cc/polyfrost/oneconfig/utils/gui/GuiUtils.java +++ b/src/main/java/cc/polyfrost/oneconfig/utils/gui/GuiUtils.java @@ -41,6 +41,7 @@ import cc.polyfrost.oneconfig.utils.TickDelay; public final class GuiUtils { private static long time = -1L; private static long deltaTime = 17L; + private static boolean wasMouseDown = false; static { EventManager.INSTANCE.register(new GuiUtils()); @@ -86,6 +87,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) { @@ -95,6 +103,8 @@ public final class GuiUtils { deltaTime = currentTime - time; time = currentTime; } + } else if (event.stage == Stage.END) { + wasMouseDown = Platform.getMousePlatform().isButtonDown(0); } } } |