round theme seams fix

This commit is contained in:
Cloudburst
2021-08-11 12:22:38 +02:00
parent 4bcc365703
commit 0b4eb9c4e7
3 changed files with 14 additions and 14 deletions

View File

@@ -21,7 +21,7 @@ public interface MeteorWidget extends BaseWidget {
int r = theme.roundAmount(); int r = theme.roundAmount();
double s = theme.scale(2); double s = theme.scale(2);
Color outlineColor = theme.outlineColor.get(pressed, mouseOver); Color outlineColor = theme.outlineColor.get(pressed, mouseOver);
GuiUtils.quadRounded(renderer, widget.x + s, widget.y + s, widget.width - s * 2, widget.height - s * 2, theme.backgroundColor.get(pressed, mouseOver), r); GuiUtils.quadRounded(renderer, widget.x + s, widget.y + s, widget.width - s * 2, widget.height - s * 2, theme.backgroundColor.get(pressed, mouseOver), r - s);
GuiUtils.quadOutlineRounded(renderer, widget, outlineColor, r, s); GuiUtils.quadOutlineRounded(renderer, widget, outlineColor, r, s);
} }
} }

View File

@@ -7,28 +7,28 @@ import meteordevelopment.meteorclient.renderer.Renderer2D;
import meteordevelopment.meteorclient.utils.render.color.Color; import meteordevelopment.meteorclient.utils.render.color.Color;
public class GuiUtils { public class GuiUtils {
public static void quadRounded(GuiRenderer renderer, double x, double y, double width, double height, Color color, int round, boolean roundTop) { public static void quadRounded(GuiRenderer renderer, double x, double y, double width, double height, Color color, double round, boolean roundTop) {
Renderer2D mb = ((GuiRendererAccessor)renderer).getRenderer2D(); Renderer2D mb = ((GuiRendererAccessor)renderer).getRenderer2D();
RoundedRenderer2D.quadRounded(mb, x, y, width, height, color, round, roundTop); RoundedRenderer2D.quadRounded(mb, x, y, width, height, color, round, roundTop);
} }
public static void quadRounded(GuiRenderer renderer, double x, double y, double width, double height, Color color, int round) { public static void quadRounded(GuiRenderer renderer, double x, double y, double width, double height, Color color, double round) {
quadRounded(renderer, x, y, width, height, color, round, true); quadRounded(renderer, x, y, width, height, color, round, true);
} }
public static void quadRounded(GuiRenderer renderer, WWidget widget, Color color, int round) { public static void quadRounded(GuiRenderer renderer, WWidget widget, Color color, double round) {
quadRounded(renderer, widget.x, widget.y, widget.width, widget.height, color, round); quadRounded(renderer, widget.x, widget.y, widget.width, widget.height, color, round);
} }
public static void quadOutlineRounded(GuiRenderer renderer, double x, double y, double width, double height, Color color, int round, double s) { public static void quadOutlineRounded(GuiRenderer renderer, double x, double y, double width, double height, Color color, double round, double s) {
Renderer2D mb = ((GuiRendererAccessor)renderer).getRenderer2D(); Renderer2D mb = ((GuiRendererAccessor)renderer).getRenderer2D();
RoundedRenderer2D.quadRoundedOutline(mb, x, y, width, height, color, round, s); RoundedRenderer2D.quadRoundedOutline(mb, x, y, width, height, color, round, s);
} }
public static void quadOutlineRounded(GuiRenderer renderer, WWidget widget, Color color, int round, double s) { public static void quadOutlineRounded(GuiRenderer renderer, WWidget widget, Color color, double round, double s) {
quadOutlineRounded(renderer, widget.x, widget.y, widget.width, widget.height, color, round, s); quadOutlineRounded(renderer, widget.x, widget.y, widget.width, widget.height, color, round, s);
} }
public static void quadRoundedSide(GuiRenderer renderer, double x, double y, double width, double height, Color color, int r, boolean right) { public static void quadRoundedSide(GuiRenderer renderer, double x, double y, double width, double height, Color color, double r, boolean right) {
Renderer2D mb = ((GuiRendererAccessor)renderer).getRenderer2D(); Renderer2D mb = ((GuiRendererAccessor)renderer).getRenderer2D();
RoundedRenderer2D.quadRoundedSide(mb, x, y, width, height, color, r, right); RoundedRenderer2D.quadRoundedSide(mb, x, y, width, height, color, r, right);
} }
public static void quadRoundedSide(GuiRenderer renderer, WWidget widget, Color color, int round, boolean right) { public static void quadRoundedSide(GuiRenderer renderer, WWidget widget, Color color, double round, boolean right) {
quadRoundedSide(renderer, widget.x, widget.y, widget.width, widget.height, color, round, right); quadRoundedSide(renderer, widget.x, widget.y, widget.width, widget.height, color, round, right);
} }
public static void circlePart(GuiRenderer renderer, double x, double y, double r, double startAngle, double angle, Color color) { public static void circlePart(GuiRenderer renderer, double x, double y, double r, double startAngle, double angle, Color color) {

View File

@@ -10,7 +10,7 @@ public class RoundedRenderer2D {
private static final double circleHalf = circleQuarter * 2; private static final double circleHalf = circleQuarter * 2;
private static final double circleThreeQuarter = circleQuarter * 3; private static final double circleThreeQuarter = circleQuarter * 3;
public static void quadRoundedOutline(Renderer2D mb, double x, double y, double width, double height, Color color, int r, double s) { public static void quadRoundedOutline(Renderer2D mb, double x, double y, double width, double height, Color color, double r, double s) {
r = getR(r, width, height); r = getR(r, width, height);
if (r == 0) { if (r == 0) {
mb.quad(x, y, width, s, color); mb.quad(x, y, width, s, color);
@@ -33,7 +33,7 @@ public class RoundedRenderer2D {
} }
} }
public static void quadRounded(Renderer2D mb, double x, double y, double width, double height, Color color, int r, boolean roundTop) { public static void quadRounded(Renderer2D mb, double x, double y, double width, double height, Color color, double r, boolean roundTop) {
r = getR(r, width, height); r = getR(r, width, height);
if (r == 0) if (r == 0)
mb.quad(x, y, width, height, color); mb.quad(x, y, width, height, color);
@@ -57,7 +57,7 @@ public class RoundedRenderer2D {
} }
} }
public static void quadRoundedSide(Renderer2D mb, double x, double y, double width, double height, Color color, int r, boolean right) { public static void quadRoundedSide(Renderer2D mb, double x, double y, double width, double height, Color color, double r, boolean right) {
r = getR(r, width, height); r = getR(r, width, height);
if (r == 0) if (r == 0)
mb.quad(x, y, width, height, color); mb.quad(x, y, width, height, color);
@@ -77,12 +77,12 @@ public class RoundedRenderer2D {
} }
} }
private static int getR(int r, double w, double h) { private static double getR(double r, double w, double h) {
if (r * 2 > h) { if (r * 2 > h) {
r = (int)h / 2; r = h / 2;
} }
if (r * 2 > w) { if (r * 2 > w) {
r = (int)w / 2; r = w / 2;
} }
return r; return r;
} }