aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/cc/polyfrost/oneconfig/lwjgl
diff options
context:
space:
mode:
authornextdaydelivery <79922345+nxtdaydelivery@users.noreply.github.com>2022-05-26 18:19:28 +0100
committernextdaydelivery <79922345+nxtdaydelivery@users.noreply.github.com>2022-05-26 18:19:28 +0100
commit7571e9bbe71c4341d6b596fec9e958704ee71b9d (patch)
tree672a372debbcdb7f3b0bfef4eecd5992cd8105fb /src/main/java/cc/polyfrost/oneconfig/lwjgl
parentc1010e9c2c6d82bd3f40c246e45cfe8e9b039d7b (diff)
downloadOneConfig-7571e9bbe71c4341d6b596fec9e958704ee71b9d.tar.gz
OneConfig-7571e9bbe71c4341d6b596fec9e958704ee71b9d.tar.bz2
OneConfig-7571e9bbe71c4341d6b596fec9e958704ee71b9d.zip
URL renderer
Diffstat (limited to 'src/main/java/cc/polyfrost/oneconfig/lwjgl')
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/lwjgl/RenderManager.java12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/main/java/cc/polyfrost/oneconfig/lwjgl/RenderManager.java b/src/main/java/cc/polyfrost/oneconfig/lwjgl/RenderManager.java
index 8a407e1..8f43aa7 100644
--- a/src/main/java/cc/polyfrost/oneconfig/lwjgl/RenderManager.java
+++ b/src/main/java/cc/polyfrost/oneconfig/lwjgl/RenderManager.java
@@ -11,6 +11,8 @@ import cc.polyfrost.oneconfig.lwjgl.image.SVGs;
import cc.polyfrost.oneconfig.libs.universal.UGraphics;
import cc.polyfrost.oneconfig.libs.universal.UMinecraft;
import cc.polyfrost.oneconfig.libs.universal.UResolution;
+import cc.polyfrost.oneconfig.utils.InputUtils;
+import cc.polyfrost.oneconfig.utils.InternetUtils;
import net.minecraft.client.gui.Gui;
import net.minecraft.client.shader.Framebuffer;
import org.lwjgl.nanovg.*;
@@ -191,6 +193,16 @@ public final class RenderManager {
nvgColor.free();
}
+ /** Draw a formatted URL (a string in blue with an underline) that when clicked, opens the given text. */
+ public static void drawURL(long vg, String url, float x, float y, float size, Fonts font) {
+ drawString(vg, url, x, y, OneConfigConfig.PRIMARY_500, size, font);
+ float length = getTextWidth(vg, url, size, font);
+ drawRectangle(vg, x, y + size / 2, length, 1, OneConfigConfig.PRIMARY_500);
+ if(InputUtils.isAreaClicked((int) (x - 2), (int) (y - 1), (int) (length + 4), (int) (size / 2 + 3))) {
+ InternetUtils.browseLink(url);
+ }
+ }
+
public static void drawWrappedString(long vg, String text, float x, float y, float width, int color, float size, Fonts font) {
nvgBeginPath(vg);
nvgFontSize(vg, size);