aboutsummaryrefslogtreecommitdiff
path: root/versions/src/main/java/cc/polyfrost
diff options
context:
space:
mode:
Diffstat (limited to 'versions/src/main/java/cc/polyfrost')
-rw-r--r--versions/src/main/java/cc/polyfrost/oneconfig/test/ButtonTestPage_Test.java9
-rw-r--r--versions/src/main/java/cc/polyfrost/oneconfig/test/TestKotlinNanoVGGui_Test.kt3
-rw-r--r--versions/src/main/java/cc/polyfrost/oneconfig/test/TestNanoVGGui_Test.java3
-rw-r--r--versions/src/main/java/cc/polyfrost/oneconfig/utils/gui/GuiUtils.java11
4 files changed, 20 insertions, 6 deletions
diff --git a/versions/src/main/java/cc/polyfrost/oneconfig/test/ButtonTestPage_Test.java b/versions/src/main/java/cc/polyfrost/oneconfig/test/ButtonTestPage_Test.java
index ce5ab00..4d04f61 100644
--- a/versions/src/main/java/cc/polyfrost/oneconfig/test/ButtonTestPage_Test.java
+++ b/versions/src/main/java/cc/polyfrost/oneconfig/test/ButtonTestPage_Test.java
@@ -29,6 +29,7 @@ package cc.polyfrost.oneconfig.test;
import cc.polyfrost.oneconfig.gui.elements.BasicButton;
import cc.polyfrost.oneconfig.gui.pages.Page;
import cc.polyfrost.oneconfig.internal.assets.SVGs;
+import cc.polyfrost.oneconfig.utils.InputHandler;
import cc.polyfrost.oneconfig.utils.color.ColorPalette;
import java.util.ArrayList;
@@ -76,20 +77,20 @@ public class ButtonTestPage_Test extends Page {
}
@Override
- public void draw(long vg, int x, int y) {
+ public void draw(long vg, int x, int y, InputHandler inputHandler) {
int buttonY = y + 16;
for (BasicButton button : row1) {
- button.draw(vg, x + 16, buttonY);
+ button.draw(vg, x + 16, buttonY, inputHandler);
buttonY += 64;
}
buttonY = y + 16;
for (BasicButton button : row2) {
- button.draw(vg, x + 286, buttonY);
+ button.draw(vg, x + 286, buttonY, inputHandler);
buttonY += 64;
}
buttonY = y + 16;
for (BasicButton button : row3) {
- button.draw(vg, x + 556, buttonY);
+ button.draw(vg, x + 556, buttonY, inputHandler);
buttonY += 64;
}
}
diff --git a/versions/src/main/java/cc/polyfrost/oneconfig/test/TestKotlinNanoVGGui_Test.kt b/versions/src/main/java/cc/polyfrost/oneconfig/test/TestKotlinNanoVGGui_Test.kt
index 8caa7d8..1af2f9e 100644
--- a/versions/src/main/java/cc/polyfrost/oneconfig/test/TestKotlinNanoVGGui_Test.kt
+++ b/versions/src/main/java/cc/polyfrost/oneconfig/test/TestKotlinNanoVGGui_Test.kt
@@ -27,6 +27,7 @@
package cc.polyfrost.oneconfig.test
import cc.polyfrost.oneconfig.renderer.font.Fonts
+import cc.polyfrost.oneconfig.utils.InputHandler
import cc.polyfrost.oneconfig.utils.dsl.*
import cc.polyfrost.oneconfig.utils.gui.OneUIScreen
import java.awt.Color
@@ -41,7 +42,7 @@ import kotlin.system.measureTimeMillis
*/
class TestKotlinNanoVGGui_Test : OneUIScreen() {
- override fun draw(vg: Long, partialTicks: Float) {
+ override fun draw(vg: Long, partialTicks: Float, inputHandler: InputHandler) {
nanoVG(vg) {
val millis = measureTimeMillis {
drawRect(0f, 0f, 100f, 100f, Color.BLUE.rgb)
diff --git a/versions/src/main/java/cc/polyfrost/oneconfig/test/TestNanoVGGui_Test.java b/versions/src/main/java/cc/polyfrost/oneconfig/test/TestNanoVGGui_Test.java
index b62c166..315eed5 100644
--- a/versions/src/main/java/cc/polyfrost/oneconfig/test/TestNanoVGGui_Test.java
+++ b/versions/src/main/java/cc/polyfrost/oneconfig/test/TestNanoVGGui_Test.java
@@ -28,6 +28,7 @@ package cc.polyfrost.oneconfig.test;
import cc.polyfrost.oneconfig.renderer.RenderManager;
import cc.polyfrost.oneconfig.renderer.font.Fonts;
+import cc.polyfrost.oneconfig.utils.InputHandler;
import cc.polyfrost.oneconfig.utils.gui.OneUIScreen;
import java.awt.*;
@@ -42,7 +43,7 @@ import java.awt.*;
public class TestNanoVGGui_Test extends OneUIScreen {
@Override
- public void draw(long vg, float partialTicks) {
+ public void draw(long vg, float partialTicks, InputHandler inputHandler) {
long startTime = System.nanoTime();
RenderManager.drawRect(vg, 0, 0, 100, 100, Color.BLUE.getRGB());
RenderManager.drawRoundedRect(vg, 305, 305, 100, 100, Color.YELLOW.getRGB(), 8);
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);
}
}
}