fuck you matrixstack nobody ever liked you anyway

This commit is contained in:
kawaiizenbo 2023-06-08 11:25:51 -07:00
parent 6e7d77dea3
commit f41e477e28
15 changed files with 65 additions and 69 deletions

View file

@ -5,8 +5,8 @@ import java.util.ArrayList;
import me.kawaiizenbo.moonlight.module.Category;
import me.kawaiizenbo.moonlight.module.ModuleManager;
import me.kawaiizenbo.moonlight.module.Module_;
import net.minecraft.client.gui.DrawContext;
import net.minecraft.client.gui.screen.Screen;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.text.Text;
public class ClickGUIScreen extends Screen
@ -32,18 +32,18 @@ public class ClickGUIScreen extends Screen
}
@Override
public void render(MatrixStack matrices, int mouseX, int mouseY, float delta)
public void render(DrawContext drawContext, int mouseX, int mouseY, float delta)
{
this.renderBackground(matrices);
this.renderBackground(drawContext);
int categoryLabelXOffset = 10;
for (Category category : Category.values())
{
textRenderer.draw(matrices, category.name, categoryLabelXOffset, 10, 0xFFFFFF);
drawContext.drawText(textRenderer, category.name, categoryLabelXOffset, 10, 0xFFFFFF, false);
categoryLabelXOffset += 70;
}
for (ModuleButton moduleButton : moduleButtons)
{
moduleButton.render(matrices, mouseX, mouseY);
moduleButton.render(drawContext, mouseX, mouseY);
}
}

View file

@ -4,7 +4,6 @@ import me.kawaiizenbo.moonlight.module.Module_;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.font.TextRenderer;
import net.minecraft.client.gui.DrawContext;
import net.minecraft.client.util.math.MatrixStack;
public class ModuleButton
{
@ -21,11 +20,11 @@ public class ModuleButton
this.height = 14;
}
public void render(MatrixStack matrices, int mouseX, int mouseY)
public void render(DrawContext drawContext, int mouseX, int mouseY)
{
TextRenderer textRenderer = mc.textRenderer;
DrawContext.fill(matrices, x, y, x + width, y + height, hovered(mouseX, mouseY) ? 0xFF333333 : 0xFF222222);
textRenderer.draw(matrices, module.name, x+3, y+3, module.enabled ? 0x55FFFF : 0xFFFFFF);
drawContext.fill(x, y, x + width, y + height, hovered(mouseX, mouseY) ? 0xFF333333 : 0xFF222222);
drawContext.drawText(textRenderer, module.name, x+3, y+3, module.enabled ? 0x55FFFF : 0xFFFFFF, false);
}
public boolean hovered(int mouseX, int mouseY)

View file

@ -6,7 +6,6 @@ import me.kawaiizenbo.moonlight.ui.TextButton;
import me.kawaiizenbo.moonlight.util.ColorUtils;
import net.minecraft.client.gui.DrawContext;
import net.minecraft.client.gui.screen.Screen;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.text.Text;
public class SettingsScreen extends Screen
@ -21,18 +20,18 @@ public class SettingsScreen extends Screen
}
@Override
public void render(MatrixStack matrices, int mouseX, int mouseY, float delta)
public void render(DrawContext drawContext, int mouseX, int mouseY, float delta)
{
this.renderBackground(matrices);
DrawContext.fill(matrices, (width/2)-112, (height/2)-96, (width/2)+112, (height/2)+96, 0xFF222222);
DrawContext.drawCenteredTextWithShadow(matrices, textRenderer, module.name, width/2, (height/2)-88, 0xFFFFFF);
DrawContext.drawTextWithShadow(matrices, textRenderer, Text.literal(module.description), (width/2)-104, (height/2)-72, 0xFFFFFF);
this.renderBackground(drawContext);
drawContext.fill((width/2)-112, (height/2)-96, (width/2)+112, (height/2)+96, 0xFF222222);
drawContext.drawCenteredTextWithShadow(textRenderer, module.name, width/2, (height/2)-88, 0xFFFFFF);
drawContext.drawTextWithShadow(textRenderer, Text.literal(module.description), (width/2)-104, (height/2)-72, 0xFFFFFF);
backButton = new TextButton(ColorUtils.underline + "< Back", (width/2)-104, (height/2)-88, 0xFFFFFF);
backButton.render(matrices, textRenderer, mouseX, mouseY);
backButton.render(drawContext, textRenderer, mouseX, mouseY);
int yOffset = (height/2)-56;
for (Setting setting : module.settings)
{
setting.render(matrices, (width/2)-96, yOffset, mouseX, mouseY);
setting.render(drawContext, (width/2)-96, yOffset, mouseX, mouseY);
yOffset += setting.height + 1;
}
// add keybind setting here eventually