aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJuuxel <6596629+Juuxel@users.noreply.github.com>2021-02-27 16:12:11 +0200
committerJuuxel <6596629+Juuxel@users.noreply.github.com>2021-02-27 16:12:11 +0200
commitd95ef9e489e24807a3fa92691700ee3d43f68a80 (patch)
treec64d07ae1affea013ac4a5a675d1badf584fed3e /src
parent5ae6164d6bcfe0c2af93afc2015443a1a7d236a0 (diff)
downloadLibGui-d95ef9e489e24807a3fa92691700ee3d43f68a80.tar.gz
LibGui-d95ef9e489e24807a3fa92691700ee3d43f68a80.tar.bz2
LibGui-d95ef9e489e24807a3fa92691700ee3d43f68a80.zip
Fix labeled slider rendering
Diffstat (limited to 'src')
-rw-r--r--src/main/java/io/github/cottonmc/cotton/gui/widget/WLabeledSlider.java13
1 files changed, 6 insertions, 7 deletions
diff --git a/src/main/java/io/github/cottonmc/cotton/gui/widget/WLabeledSlider.java b/src/main/java/io/github/cottonmc/cotton/gui/widget/WLabeledSlider.java
index ef5391e..ba5edd4 100644
--- a/src/main/java/io/github/cottonmc/cotton/gui/widget/WLabeledSlider.java
+++ b/src/main/java/io/github/cottonmc/cotton/gui/widget/WLabeledSlider.java
@@ -1,10 +1,10 @@
package io.github.cottonmc.cotton.gui.widget;
-import com.mojang.blaze3d.systems.RenderSystem;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.client.gui.widget.AbstractButtonWidget;
import net.minecraft.client.util.math.MatrixStack;
+import net.minecraft.client.util.math.Vector3f;
import net.minecraft.text.Text;
import io.github.cottonmc.cotton.gui.client.ScreenDrawing;
@@ -155,7 +155,6 @@ public class WLabeledSlider extends WAbstractSlider {
return x >= 0 && x <= width && y >= 0 && y <= height;
}
- @SuppressWarnings("deprecation")
@Environment(EnvType.CLIENT)
@Override
public void paint(MatrixStack matrices, int x, int y, int mouseX, int mouseY) {
@@ -166,11 +165,11 @@ public class WLabeledSlider extends WAbstractSlider {
: (direction == Direction.UP ? height - mouseY : mouseY);
int rotMouseY = axis == Axis.HORIZONTAL ? mouseY : mouseX;
- RenderSystem.pushMatrix();
- RenderSystem.translatef(x, y, 0);
+ matrices.push();
+ matrices.translate(x, y, 0);
if (axis == Axis.VERTICAL) {
- RenderSystem.translatef(0, height, 0);
- RenderSystem.rotatef(270, 0, 0, 1);
+ matrices.translate(0, height, 0);
+ matrices.multiply(Vector3f.POSITIVE_Z.getDegreesQuaternion(270));
}
drawButton(matrices, 0, 0, 0, aWidth);
@@ -193,7 +192,7 @@ public class WLabeledSlider extends WAbstractSlider {
int color = isMouseInsideBounds(mouseX, mouseY) ? 0xFFFFA0 : 0xE0E0E0;
ScreenDrawing.drawStringWithShadow(matrices, label.asOrderedText(), labelAlignment, 2, aHeight / 2 - 4, aWidth - 4, color);
}
- RenderSystem.popMatrix();
+ matrices.pop();
}
// state = 1: regular, 2: hovered, 0: disabled/dragging