aboutsummaryrefslogtreecommitdiff
path: root/versions/src/main/java/cc/polyfrost/oneconfig/utils/gui
diff options
context:
space:
mode:
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.java11
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);
}
}
}