aboutsummaryrefslogtreecommitdiff
path: root/src/main/java
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
parentc1010e9c2c6d82bd3f40c246e45cfe8e9b039d7b (diff)
downloadOneConfig-7571e9bbe71c4341d6b596fec9e958704ee71b9d.tar.gz
OneConfig-7571e9bbe71c4341d6b596fec9e958704ee71b9d.tar.bz2
OneConfig-7571e9bbe71c4341d6b596fec9e958704ee71b9d.zip
URL renderer
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/gui/pages/HomePage.java2
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/lwjgl/RenderManager.java12
2 files changed, 14 insertions, 0 deletions
diff --git a/src/main/java/cc/polyfrost/oneconfig/gui/pages/HomePage.java b/src/main/java/cc/polyfrost/oneconfig/gui/pages/HomePage.java
index f576b7b..e2c342c 100644
--- a/src/main/java/cc/polyfrost/oneconfig/gui/pages/HomePage.java
+++ b/src/main/java/cc/polyfrost/oneconfig/gui/pages/HomePage.java
@@ -48,6 +48,8 @@ public class HomePage extends Page {
RenderManager.drawString(vg, "Info", x + 52, y + 618, OneConfigConfig.WHITE_90, 24f, Fonts.MEDIUM);
RenderManager.drawRoundedRect(vg, x + 16, y + 644, 1024, 64, OneConfigConfig.GRAY_700, 20f);
+ RenderManager.drawURL(vg, "https://www.youtube.com/watch?v=dQw4w9WgXcQ", x + 100, y + 205, 24, Fonts.MEDIUM);
+
discordBtn.draw(vg, x + 32, y + 658);
webBtn.draw(vg, x + 232, y + 658);
socialsBtn.draw(vg, x + 432, y + 658);
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);