aboutsummaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
authorJuuxel <6596629+Juuxel@users.noreply.github.com>2020-01-20 20:47:00 +0200
committerJuuxel <6596629+Juuxel@users.noreply.github.com>2020-01-20 20:47:00 +0200
commit661754ffb1e7150659d7dc43d3a7d024d776f0b5 (patch)
treef0724ff1767e6542a6f3eea87cf3d49a1278ff3c /src/main
parente413c03201f943200a3abcd8e9444335705e71ab (diff)
downloadLibGui-661754ffb1e7150659d7dc43d3a7d024d776f0b5.tar.gz
LibGui-661754ffb1e7150659d7dc43d3a7d024d776f0b5.tar.bz2
LibGui-661754ffb1e7150659d7dc43d3a7d024d776f0b5.zip
Actually fix WClippedPanel
Thanks @vini2003!
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/io/github/cottonmc/cotton/gui/widget/WClippedPanel.java5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/main/java/io/github/cottonmc/cotton/gui/widget/WClippedPanel.java b/src/main/java/io/github/cottonmc/cotton/gui/widget/WClippedPanel.java
index 23acfc0..191e7ef 100644
--- a/src/main/java/io/github/cottonmc/cotton/gui/widget/WClippedPanel.java
+++ b/src/main/java/io/github/cottonmc/cotton/gui/widget/WClippedPanel.java
@@ -24,10 +24,13 @@ public class WClippedPanel extends WPanel {
GL11.glEnable(GL11.GL_SCISSOR_TEST);
MinecraftClient mc = MinecraftClient.getInstance();
+ int rawHeight = mc.getWindow().getHeight();
double scaleFactor = mc.getWindow().getScaleFactor();
int scaledWidth = (int) (getWidth() * scaleFactor);
int scaledHeight = (int) (getHeight() * scaleFactor);
- GL11.glScissor((int) (x * scaleFactor), (int) ((y + scaleFactor * (1 - this.y + 18)) * scaleFactor), scaledWidth, scaledHeight);
+
+ // Expression for Y coordinate adapted from vini2003's Spinnery (code snippet released under WTFPL)
+ GL11.glScissor((int) (x * scaleFactor), (int) (rawHeight - (y * scaleFactor) - scaledHeight), scaledWidth, scaledHeight);
for(WWidget child : children) {
child.paintBackground(x + child.getX(), y + child.getY(), mouseX-child.getX(), mouseY-child.getY());