11package com .coflnet .gui ;
22
33import com .mojang .blaze3d .systems .RenderSystem ;
4+ import com .mojang .blaze3d .vertex .VertexFormat ;
5+ import net .fabricmc .fabric .impl .renderer .RendererManager ;
46import net .minecraft .client .MinecraftClient ;
57import net .minecraft .client .font .TextRenderer ;
68import net .minecraft .client .gui .DrawContext ;
@@ -37,8 +39,7 @@ public static void drawRect(DrawContext context, float x, float y, float width,
3739 buffer .vertex (context .getMatrices ().peek ().getPositionMatrix (), x + width , y + height , z ).color (color );
3840 buffer .vertex (context .getMatrices ().peek ().getPositionMatrix (), x + width , y , z ).color (color );
3941
40- RenderSystem .setShader (GameRenderer ::getPositionColorProgram );
41- BufferRenderer .drawWithGlobalProgram (buffer .end ());
42+ RenderLayer .getGui ().draw (buffer .end ()); // drawWithGlobalProgram(buffer.end());
4243 }
4344
4445
@@ -50,7 +51,7 @@ public static void drawRectOutline(DrawContext context, int x, int y, int width,
5051
5152 //draws a circle with a given radius and thickness
5253 public static void drawCircle (DrawContext context , int x , int y , int radius , int color ) {
53- buffer = tessellator .begin (VertexFormat .DrawMode .TRIANGLE_FAN , VertexFormats .POSITION_COLOR );
54+ buffer = tessellator .begin (VertexFormat .DrawMode .TRIANGLE_STRIP , VertexFormats .POSITION_COLOR );
5455
5556 for (int i = 0 ; i <= 360 ; i ++) {
5657 buffer .vertex (
@@ -61,11 +62,11 @@ public static void drawCircle(DrawContext context, int x, int y, int radius, int
6162 ).color (color );
6263 }
6364
64- RenderSystem .setShader (GameRenderer ::getPositionColorProgram );
65- //RenderSystem.setShaderColor(0.0F, 0.0F, 0.0F, 0.0F);
66-
67- BufferRenderer .drawWithGlobalProgram (buffer .end ());
65+ //RenderSystem.setShader(GameRenderer::getPositionColorProgram);
66+ //RenderSystem.setShaderColor(0.0F, 0.0F, 0.0F, 1.0F);
6867
68+ //BufferRenderer.drawWithGlobalProgram(buffer.end());
69+ RenderLayer .getGui ().draw (buffer .end ());
6970 }
7071
7172 //draws a circle outline with a given radius and thickness
@@ -131,9 +132,11 @@ public static void drawArc(DrawContext context, int x, int y, int radius, int st
131132 z
132133 ).color (color );
133134 }
134- RenderSystem .setShader (GameRenderer ::getPositionColorProgram );
135+
136+ //RenderSystem.setShader(GameRenderer::getPositionColorProgram);
135137 //RenderSystem.setShaderColor(0.0F, 0.0F, 0.0F, 0.0F);
136- BufferRenderer .drawWithGlobalProgram (buffer .end ());
138+ //BufferRenderer.drawWithGlobalProgram(buffer.end());
139+ RenderLayer .getGui ().draw (buffer .end ());
137140 }
138141
139142
@@ -149,9 +152,10 @@ public static void drawLoadingCircle(DrawContext context, float x, float y, floa
149152 z
150153 ).color (color );
151154 }
152- RenderSystem .setShader (GameRenderer ::getPositionColorProgram );
155+ // RenderSystem.setShader(GameRenderer::getPositionColorProgram);
153156 //RenderSystem.setShaderColor(0.0F, 0.0F, 0.0F, 0.0F);
154- BufferRenderer .drawWithGlobalProgram (buffer .end ());
157+ //BufferRenderer.drawWithGlobalProgram(buffer.end());
158+ RenderLayer .getGui ().draw (buffer .end ());
155159 }
156160
157161 //draws a rounded rectangle with a given radius and color and size
0 commit comments