diff options
author | syeyoung <cyong06@naver.com> | 2021-07-20 21:49:59 +0900 |
---|---|---|
committer | syeyoung <cyong06@naver.com> | 2021-07-20 21:49:59 +0900 |
commit | aa804403a1dcc8f9b36672e0e56e591e810147b3 (patch) | |
tree | dbfbda2b57c23da17791031507a8693fb7313b0e /src/main/java/kr/syeyoung/dungeonsguide/utils | |
parent | 82a849d7aee17d7e59397f0858a24b51b59a69a6 (diff) | |
download | Skyblock-Dungeons-Guide-aa804403a1dcc8f9b36672e0e56e591e810147b3.tar.gz Skyblock-Dungeons-Guide-aa804403a1dcc8f9b36672e0e56e591e810147b3.tar.bz2 Skyblock-Dungeons-Guide-aa804403a1dcc8f9b36672e0e56e591e810147b3.zip |
Popups in gui config
Diffstat (limited to 'src/main/java/kr/syeyoung/dungeonsguide/utils')
-rwxr-xr-x | src/main/java/kr/syeyoung/dungeonsguide/utils/RenderUtils.java | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/utils/RenderUtils.java b/src/main/java/kr/syeyoung/dungeonsguide/utils/RenderUtils.java index c2dfdb68..b6c5c22d 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/utils/RenderUtils.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/utils/RenderUtils.java @@ -55,6 +55,49 @@ public class RenderUtils { public static boolean allowScrolling; public static int scrollX = 0; + public static void drawRoundedRectangle(int x, int y, int width, int height, int radius, double delta, int color) { + GlStateManager.pushMatrix(); + GlStateManager.translate(width/2.0+x, height/2.0+y, 0); + Tessellator t = Tessellator.getInstance(); + GlStateManager.disableTexture2D(); + GlStateManager.disableCull(); + RenderUtils.GL_SETCOLOR(color); + WorldRenderer wr = t.getWorldRenderer(); + wr.begin(GL11.GL_POLYGON, DefaultVertexFormats.POSITION); + for (double i = 0.1; i < Math.PI*2; i+= delta) { + double cos = MathHelper.cos((float) i); + double sin = MathHelper.sin((float) i); + if (cos != 0 || sin != 0) + wr.pos(cos * radius + (cos < 0 ? -width/2.0+radius : width/2.0-radius), + sin * radius + (sin <= 0 ? -height/2.0+radius : height/2.0-radius), 0) + .endVertex(); // .color((int) (i/(Math.PI*2) * 255),0,0,255) + if (cos *MathHelper.cos((float) (i + delta)) <= 0) { // X Change + sin = Math.round(sin); + + wr.pos((cos < 0 ? -1 : 1) * (width/2.0 - radius), + sin * radius + (sin < 0 ? -height/2.0+radius : height/2.0-radius), 0).endVertex(); + wr.pos((cos < 0 ? 1 : -1) * (width/2.0 - radius), + sin * radius + (sin < 0 ? -height/2.0+radius : height/2.0-radius), 0).endVertex(); + } else if (sin * MathHelper.sin((float) (i+delta)) <= 0) { // Y Change + cos = Math.round(cos); + + wr.pos(cos * radius + (cos < 0 ? -width/2.0+radius : width/2.0-radius), + (sin < 0 ? -1 : 1) *(height/2.0 - radius), 0).endVertex(); + wr.pos(cos * radius + (cos < 0 ? -width/2.0+radius : width/2.0-radius), + (sin < 0 ? 1 : -1) *(height/2.0 - radius), 0).endVertex(); + } + } + t.draw(); + GlStateManager.popMatrix(); + } + + public static void GL_SETCOLOR(int color) { + float f3 = (float)(color >> 24 & 255) / 255.0F; + float f = (float)(color >> 16 & 255) / 255.0F; + float f1 = (float)(color >> 8 & 255) / 255.0F; + float f2 = (float)(color & 255) / 255.0F; + GlStateManager.color(f, f1, f2, f3); + } public static int blendTwoColors(int background, int newColor) { float alpha = ((newColor >> 24) & 0xFF) /255.0f; |