From 78a04f87d512b8885dd3fe344da26d0fc6833904 Mon Sep 17 00:00:00 2001 From: ThisIsALegitUsername Date: Tue, 27 Dec 2022 21:55:46 +0000 Subject: [PATCH] Port rendering utils --- bin/main/dev/resent/ui/mods/ClickGUI.class | Bin 8999 -> 8952 bytes .../dev/resent/util/render/RenderUtils.class | Bin 4806 -> 1986 bytes .../java/dev/resent/ui/mods/ClickGUI.java | 2 +- .../dev/resent/util/render/RenderUtils.java | 201 +----------------- 4 files changed, 8 insertions(+), 195 deletions(-) diff --git a/bin/main/dev/resent/ui/mods/ClickGUI.class b/bin/main/dev/resent/ui/mods/ClickGUI.class index 0bf5a8d6be8480094f7db9bd09eb9dde71fdc593..c81e8eab6d1c116a44e39ded71b96105c9ed5f94 100644 GIT binary patch delta 1327 zcmZ8gZBSHI7=GS+_w3od+=b<1VVC7&7nD!eSP>1Rl8PEr)0`%9)Jcf_(O}xZ5=ki) zGmeR7c*R zO`3wgbzH|)g1VsmZj01{R#>I_O$(_6>w-XCV0qBv^Jv&YOh-s&xG$>E8bvlvIw4Es z+tO^a11qamRMuAO6iqQ=ca+B*t5Y1si_xf=RtF_sF#^Nl)=d>_Ub;$6zB9pb1vm`$`d)Z9GWB^usKYV38}4iw?4tIk&g;=#FJmN z+9oFYs8FY=NFcDfU}bHP)3lq?DH;_~fiV^KT(B{2ErU&d;9m)HtajvuFvp&-RKhHK zrUCccwd$TWM}TNlL=sCZV-+%ZSKJ?>EXf}|s!rpbY@Uob4=5et*`!=DiAa)DlMy4$ zTc#hxuzj{jaysl6+n{%2Jd9(Vuy*5`D0Lo}Ij_YydDo4U5%GvCTP$(SP~swDt7|cl z7|0u zif6^jUsIJ zqtCn&{pO1jFJr(Q!5}wd506IE5$?wqd_Iow2QkbmFv4r_C2x}0jAOhNUAzM)co$Cc z9(>QkIK@A}X+DUx{3w2cNBZ|gL>tcvUS!CX!3Lp8HyP|B$rOW;8Fr{}^L~6HVg@rFK)vSbsAQAXZFac~f2i=*BNnK`BI z*AP2EzJ+;xbW50~bRy3EI-&=t$cRi2)2-5cPT|j(L&aisMul2JGsHI;1?i3Bme*a delta 1397 zcmZ8h3v5$W82edqk= z=G=3$qJ6e@a_GQ^0E%hmUai3@0$NVy*Eml|j?^t#UAeNMHWH0gMwiA2*3fKYh`2R6 z{!3iZ@dJMRS0@GY8e%moYNG^8XpS**7ijnizi|9a@NEwJGIU%s43^=Er9s02{Ho(O z{4SzeasCYgJ)j|mTRQ&4pj>Z7eMRk(M{1%Gf*Q(w(29QC)-i-T;;2?Ifk-C>cVw-y zVwQzW(!SCv?Qd9!OLJwkK3W^|7y31{kX1(j(*cHK=rk)!8WJml9YKtWNdPq&Vu(VTJ!Aw#oPPgQjqBaZ1s z=0Y0BY3vqz$UPn*LejEmtYVdHVpi4iXtajY1o5Ul%NEusOvO4<=`Jx~52h_J;)yzy z!bxEDu_bjePUTV>w3Jb?MrAayv(L`B^&Z&e1OAmb=UkW3lo!Xn4(DP6=Qy&5ajrv) zH0hl+t|-w}@p)Rg<$9GY&rJD4INf3QRkeh-v-vWUeoSdM3USTg; zQMraqY8p1HrP!iQ!A5mDgt`nbsGIPj+J=`J)#G?s{Z!K$#6)nONF#csA!@;%riKhj>dA04a*ova^m_60s* z14x)l(Pe%L`^vz{dLN1Wuw4IzENG7~r`>mql-86MZaZXZ5SP{GHSN{Q*0ivNxA(v`nJx63Oa5 zN|I+P94BXj(uE~3S{+H5A{_8?XPmO)lr8QH6pai~?yx?S@?;Z=v5ee@;^H967jFed zWfx5LzKRju6keFuMMViJX-A6pH6(RYnUR^4pvmG&AVPPGdBG}m3QZN;gX6QN$$1o- RPBSE?NEVhT2bKMUe*=zxXD0vv diff --git a/bin/main/dev/resent/util/render/RenderUtils.class b/bin/main/dev/resent/util/render/RenderUtils.class index 3fd4f32f216c55a8c55fbf5f81f21b6250aaff81..a1835278c1007d7dd99d2dd8378dd7021cab5dd8 100644 GIT binary patch literal 1986 zcmb`IOKcle6o&ta9ouoIBypRBI!Ti>4YlJs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}Vfz^eyMrOJ35W zp}@8YG#|lO7KcND$1T1)i`PQ|I-_^8T+azI=L7NN-avFVoi|}{F0RK*6*uFC&NC|%o(qX-7 zb=LpKIDun0jpO)&+}D`Ec}(IWP7#hz@jK4o4}5OHXupnEkcLSc8IDRU`V(DlG?eA8 zQgH=JuM%i4#xR}(JeC9e@(jQ)(#E_2K9t3)dB9^?j28gDCl5Hm-<=11a~7R>z$tIZ z174X$eID?2S%eArF`~_p;27i>IyM7g%0@W$T4M&jXNl^UMD#17d5%bagR}USv-9`? v-{BH2;AebafbZph!`C6Mg^sJtpce=5{H!m+3$wfkzf8Rd5?*A4C3xu{za=t@ diff --git a/src/main/java/dev/resent/ui/mods/ClickGUI.java b/src/main/java/dev/resent/ui/mods/ClickGUI.java index 3bda0cd1..ee620605 100644 --- a/src/main/java/dev/resent/ui/mods/ClickGUI.java +++ b/src/main/java/dev/resent/ui/mods/ClickGUI.java @@ -111,7 +111,7 @@ public class ClickGUI extends GuiScreen { int off = 0; // background - RenderUtils.drawRoundedRect(x - 10, y + 20, width + 35, height - 10, 1, new Color(35, 39, 42, 80).getRGB()); + Gui.drawRect(x - 10, y + 20, width + 35, height - 10, new Color(35, 39, 42, 80).getRGB()); fr.drawString(Resent.NAME + " Client " + Resent.VERSION, x + 8, height - 2, -1); RenderUtils.drawRectOutline(GuiScreen.width/2-fr.getStringWidth("Edit Layout")/2-5, GuiScreen.height - y - fr.FONT_HEIGHT, GuiScreen.width / 2 - fr.getStringWidth("Edit Layout") / 2 + 5 + fr.getStringWidth("Edit Layout"), GuiScreen.height - y + 5, -1); Gui.drawRect(GuiScreen.width/2-fr.getStringWidth("Edit Layout")/2-4, diff --git a/src/main/java/dev/resent/util/render/RenderUtils.java b/src/main/java/dev/resent/util/render/RenderUtils.java index dafccda8..52f8bc3a 100644 --- a/src/main/java/dev/resent/util/render/RenderUtils.java +++ b/src/main/java/dev/resent/util/render/RenderUtils.java @@ -1,174 +1,9 @@ package dev.resent.util.render; import dev.resent.setting.ModeSetting; +import net.minecraft.client.gui.Gui; public class RenderUtils { - /*public static void drawChromaString(String string, int x, int y, boolean shadow) { - Minecraft mc = Minecraft.getMinecraft(); - - int xTmp = x; - boolean hasReachedSS = false; - boolean hasFinished = false; - - for (char textChar : string.toCharArray()) { - long l = System.currentTimeMillis() - (xTmp * 10 - y * 10); - int i = Color.HSBtoRGB(l % (int) 2000.0F / 2000.0F, 0.8F, 0.8F); - String tmp = String.valueOf(textChar); - - if (Character.toString(textChar).equalsIgnoreCase("ยง")) { - hasReachedSS = true; - } - - if (!hasReachedSS) { - mc.fontRendererObj.drawString(tmp, xTmp, y, i, shadow); - xTmp += mc.fontRendererObj.getCharWidth(textChar); - - string = string.substring(1); - } else if (!hasFinished) { - - mc.fontRendererObj.drawString(string, xTmp, y, -1, shadow); - hasFinished = true; - } - } - } - - public static void drawRoundedRect(int x, int y, int width, int height, int round, int color) { - int yy = 0; - for (int xx = round; xx >= 1; --xx) { - Gui.drawRect(x + xx, y + yy - 1, x + (width - xx), y + yy - 1 + 1, color); - ++y; - } - Gui.drawRect(x, y + yy - 1, x + width, y + yy + (height - (round)) - 1, color); - yy = 0; - for (int xx = 1; xx <= round; xx++) { - Gui.drawRect(x + xx, y + yy + (height - (round)) - 1, x + (width - xx), y + yy + (height - (round)) - 1 + 1, - color); - ++yy; - } - } - - public static int astolfoColorsDraw(int yOffset, int yTotal) { - return astolfoColorsDraw(yOffset, yTotal, 50000f); - } - - public static int astolfoColorsDraw(int yOffset, int yTotal, float speed) { - float hue = (float) (System.currentTimeMillis() % (int) speed) + ((yTotal - yOffset) * 9); - while (hue > speed) { - hue -= speed; - } - hue /= speed; - if (hue > 0.5) { - hue = 0.5F - (hue - 0.5f); - } - hue += 0.5F; - return Color.HSBtoRGB(hue, 0.5f, 1F); - } -*/ - public static void drawRectOutline(int x, int y, int width, int height, int color) { - Gui.drawRect(x, y, width, y + 1, color); - Gui.drawRect(x, y, x + 1, height, color); - Gui.drawRect(width - 1, y, width, height, color); - Gui.drawRect(x, height - 1, width, height, color); - } - - public static void drawRoundedRectOutline(int x, int y, int width, int height, int color) { - drawRoundedRect(x, y, width, y + 0.5f, 2, color); - drawRoundedRect(x, y, x + 0.5f, height, 2, color); - drawRoundedRect(width - 0.5f, y, width, height, 2, color); - drawRoundedRect(x, height - 0.5f, width, height, 2, color); - } -/* - public static void drawChromaRectangle(int x, int y, int width, int height) { - for (int i = x; i < width; i += 10) { - Gui.drawRect(i, y, i + 10, height, RenderUtils.astolfoColorsDraw(i, GuiScreen.width, 20000f)); - } - } - - public static void drawRoundedRect(int x, int y, int width, int height, int round) { - int yy = 0; - for (int xx = round; xx >= 1; --xx) { - Gui.drawRect(x + xx, y + yy - 1, x + (width - xx), y + yy - 1 + 1); - ++y; - } - Gui.drawRect(x, y + yy - 1, x + width, y + yy + (height - (round)) - 1); - yy = 0; - for (int xx = 1; xx <= round; xx++) { - Gui.drawRect(x + xx, y + yy + (height - (round)) - 1, x + (width - xx), - y + yy + (height - (round)) - 1 + 1); - ++yy; - } - }*/ - - public static void circle(final float x, final float y, final float radius, final int fill) { - arc(x, y, 0.0f, 360.0f, radius, fill); - } - - public static void arc(final float x, final float y, final float start, final float end, final float radius, - final int color) { - arcEllipse(x, y, start, end, radius, radius, color); - } - - public static void arcEllipse(final float x, final float y, float start, float end, final float w, final float h, - final int color) { - EaglerAdapter.glColor3f(0.0f, 0.0f, 0.0f); - EaglerAdapter.glColor4f(0.0f, 0.0f, 0.0f, 0.0f); - float temp = 0.0f; - if (start > end) { - temp = end; - end = start; - start = temp; - } - final float var11 = (color >> 24 & 0xFF) / 255.0f; - final float var12 = (color >> 16 & 0xFF) / 255.0f; - final float var13 = (color >> 8 & 0xFF) / 255.0f; - final float var14 = (color & 0xFF) / 255.0f; - final Tessellator var15 = Tessellator.instance; - EaglerAdapter.glEnable(EaglerAdapter.GL_BLEND); - EaglerAdapter.glDisable(EaglerAdapter.GL_TEXTURE_2D); - EaglerAdapter.glBlendFunc(770, 771); - EaglerAdapter.glColor4f(var12, var13, var14, var11); - if (var11 > 0.5f) { - EaglerAdapter.glEnable(EaglerAdapter.GL_LINES); - EaglerAdapter.glLineWidth(2.0f); - EaglerAdapter.glBeginQuery(3); - for (float i = end; i >= start; i -= 4.0f) { - final float ldx = (float) Math.cos(i * Math.PI / 180.0) * w * 1.001f; - final float ldy = (float) Math.sin(i * Math.PI / 180.0) * h * 1.001f; - var15.addVertex(x + ldx, y + ldy, 0); - } - EaglerAdapter.glEndQuery(); - EaglerAdapter.glDisable(EaglerAdapter.GL_LINES); - } - EaglerAdapter.glBeginQuery(6); - for (float i = end; i >= start; i -= 4.0f) { - final float ldx = (float) Math.cos(i * Math.PI / 180.0) * w; - final float ldy = (float) Math.sin(i * Math.PI / 180.0) * h; - var15.addVertex(x + ldx, y + ldy, 0); - } - EaglerAdapter.glEndQuery(); - EaglerAdapter.glEnable(EaglerAdapter.GL_TEXTURE_2D); - EaglerAdapter.glDisable(EaglerAdapter.GL_BLEND); - } - - public static void drawRoundedRect(float x, float y, float x2, float y2, final float round, final int color) { - x += (float) (round / 2.0f + 0.5); - y += (float) (round / 2.0f + 0.5); - x2 -= (float) (round / 2.0f + 0.5); - y2 -= (float) (round / 2.0f + 0.5); - Gui.drawRect((int)x, (int)y, (int)x2, (int)y2, color); - circle(x2 - round / 2.0f, y + round / 2.0f, round, color); - circle(x + round / 2.0f, y2 - round / 2.0f, round, color); - circle(x + round / 2.0f, y + round / 2.0f, round, color); - circle(x2 - round / 2.0f, y2 - round / 2.0f, round, color); - Gui.drawRect((int)(x - round / 2.0f - 0.5f), (int)(y + round / 2.0f), (int)x2, (int)(y2 - (int)round / 2.0f), - color); - Gui.drawRect((int)x, ((int)y + (int)round / 2), ((int)x2 + (int)round / 2 + (int)0.5f), ((int)y2 - (int)round / 2), - color); - Gui.drawRect(((int)x + (int)round / 2), ((int)y - (int)round / 2 - (int)0.5f), ((int)x2 - (int)round / 2), - (int) (y2 - round / 2.0f), color); - Gui.drawRect(((int)x + (int)round / 2), (int)y, (int)(x2 - round / 2.0f), (int)(y2 + round / 2.0f + 0.5f), - color); - } public static int getColor(ModeSetting asdf) { switch (asdf.getValue()) { @@ -214,33 +49,11 @@ public class RenderUtils { return Color.WHITE; } - public static void drawGradientRect(int par1, int par2, int par3, int par4, int par5, int par6) { - float var7 = (float) (par5 >> 24 & 255) / 255.0F; - float var8 = (float) (par5 >> 16 & 255) / 255.0F; - float var9 = (float) (par5 >> 8 & 255) / 255.0F; - float var10 = (float) (par5 & 255) / 255.0F; - float var11 = (float) (par6 >> 24 & 255) / 255.0F; - float var12 = (float) (par6 >> 16 & 255) / 255.0F; - float var13 = (float) (par6 >> 8 & 255) / 255.0F; - float var14 = (float) (par6 & 255) / 255.0F; - EaglerAdapter.glDisable(EaglerAdapter.GL_TEXTURE_2D); - EaglerAdapter.glEnable(EaglerAdapter.GL_BLEND); - EaglerAdapter.glDisable(EaglerAdapter.GL_ALPHA_TEST); - EaglerAdapter.glBlendFunc(EaglerAdapter.GL_SRC_ALPHA, EaglerAdapter.GL_ONE_MINUS_SRC_ALPHA); - EaglerAdapter.glShadeModel(EaglerAdapter.GL_SMOOTH); - Tessellator var15 = Tessellator.instance; - var15.startDrawingQuads(); - var15.setColorRGBA_F(var8, var9, var10, var7); - var15.addVertex((double) par3, (double) par2, 0.0); - var15.addVertex((double) par1, (double) par2, 0.0); - var15.setColorRGBA_F(var12, var13, var14, var11); - var15.addVertex((double) par1, (double) par4, 0.0); - var15.addVertex((double) par3, (double) par4, 0.0); - var15.draw(); - EaglerAdapter.glShadeModel(EaglerAdapter.GL_FLAT); - EaglerAdapter.glDisable(EaglerAdapter.GL_BLEND); - EaglerAdapter.glEnable(EaglerAdapter.GL_ALPHA_TEST); - EaglerAdapter.glEnable(EaglerAdapter.GL_TEXTURE_2D); - } + public static void drawRectOutline(int x, int y, int width, int height, int color) { + Gui.drawRect(x, y, width, y + 1, color); + Gui.drawRect(x, y, x + 1, height, color); + Gui.drawRect(width - 1, y, width, height, color); + Gui.drawRect(x, height - 1, width, height, color); + } }