h
This commit is contained in:
parent
3de1c7130a
commit
e5b783553b
10 changed files with 56 additions and 31 deletions
|
@ -2,24 +2,15 @@ package me.kawaiizenbo.moonlight.module.modules;
|
|||
|
||||
import me.kawaiizenbo.moonlight.module.Category;
|
||||
import me.kawaiizenbo.moonlight.module.Module_;
|
||||
import me.kawaiizenbo.moonlight.module.settings.BooleanSetting;
|
||||
import me.kawaiizenbo.moonlight.module.settings.ColorSetting;
|
||||
|
||||
public class HUDModule extends Module_
|
||||
{
|
||||
public BooleanSetting enableLogo = new BooleanSetting("Logo", true);
|
||||
public BooleanSetting enableFPS = new BooleanSetting("FPS", true);
|
||||
public BooleanSetting enablePing = new BooleanSetting("Ping", true);
|
||||
public BooleanSetting enableSpeed = new BooleanSetting("Speed", true);
|
||||
public BooleanSetting enableCoordinates = new BooleanSetting("Coordinates", true);
|
||||
|
||||
public ColorSetting color = new ColorSetting("Color", 0x55FFFF);
|
||||
public HUDModule()
|
||||
{
|
||||
super("HUD", "Enables or disables the Moonlight HUD.", Category.RENDER);
|
||||
this.enabled = true;
|
||||
settings.add(enableLogo);
|
||||
settings.add(enableFPS);
|
||||
settings.add(enablePing);
|
||||
settings.add(enableSpeed);
|
||||
settings.add(enableCoordinates);
|
||||
settings.add(color);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,41 @@
|
|||
package me.kawaiizenbo.moonlight.module.settings;
|
||||
|
||||
import net.minecraft.client.gui.DrawableHelper;
|
||||
import net.minecraft.client.gui.widget.TextFieldWidget;
|
||||
import net.minecraft.client.util.math.MatrixStack;
|
||||
import net.minecraft.text.Text;
|
||||
|
||||
public class ColorSetting extends Setting
|
||||
{
|
||||
public int value;
|
||||
public int r;
|
||||
public int g;
|
||||
public int b;
|
||||
|
||||
|
||||
public ColorSetting(String name, int value)
|
||||
{
|
||||
this.name = name;
|
||||
this.value = value;
|
||||
this.height = 64;
|
||||
this.r = (value >> 16) & 0xFF;
|
||||
this.g = (value >> 8) & 0xFF;
|
||||
this.b = value & 0xFF;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(MatrixStack matrices, int x, int y, int mouseX, int mouseY)
|
||||
{
|
||||
super.render(matrices, x, y, mouseX, mouseY);
|
||||
DrawableHelper.drawTextWithShadow(matrices, textRenderer, Text.literal(name), x+2, y+2, 0xFFFFFF);
|
||||
int redDisplayStartColor = ((255&0x0ff)<<24)|((0&0x0ff)<<16)|((g&0x0ff)<<8)|(b&0x0ff);
|
||||
int redDisplayEndColor = ((255&0x0ff)<<24)|((255&0x0ff)<<16)|((g&0x0ff)<<8)|(b&0x0ff);
|
||||
int greenDisplayStartColor = ((255&0x0ff)<<24)|((r&0x0ff)<<16)|((0&0x0ff)<<8)|(b&0x0ff);
|
||||
int greenDisplayEndColor = ((255&0x0ff)<<24)|((r&0x0ff)<<16)|((255&0x0ff)<<8)|(b&0x0ff);
|
||||
int blueDisplayStartColor = ((255&0x0ff)<<24)|((r&0x0ff)<<16)|((g&0x0ff)<<8)|(0&0x0ff);
|
||||
int blueDisplayEndColor = ((255&0x0ff)<<24)|((r&0x0ff)<<16)|((g&0x0ff)<<8)|(255&0x0ff);
|
||||
DrawableHelper.fillGradient(matrices, x+100, y+2, x+112, y+62, redDisplayEndColor, redDisplayStartColor, 0);
|
||||
DrawableHelper.fillGradient(matrices, x+115, y+2, x+127, y+62, greenDisplayEndColor, greenDisplayStartColor, 0);
|
||||
DrawableHelper.fillGradient(matrices, x+130, y+2, x+142, y+62, blueDisplayEndColor, blueDisplayStartColor, 0);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,13 +9,14 @@ public class Setting
|
|||
{
|
||||
public String name;
|
||||
protected TextRenderer textRenderer = MinecraftClient.getInstance().textRenderer;
|
||||
public int height = 24;
|
||||
|
||||
int x = 0, y = 0;
|
||||
public void render(MatrixStack matrices, int x, int y, int mouseX, int mouseY)
|
||||
{
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
DrawableHelper.fill(matrices, x, y, x+192, y+24, hovered(mouseX, mouseY) ? 0xFF444444: 0xFF222222);
|
||||
DrawableHelper.fill(matrices, x, y, x+192, y+height, hovered(mouseX, mouseY) ? 0xFF444444: 0xFF222222);
|
||||
|
||||
}
|
||||
|
||||
|
@ -27,6 +28,6 @@ public class Setting
|
|||
|
||||
protected boolean hovered(int mouseX, int mouseY)
|
||||
{
|
||||
return mouseX >= x && mouseX <= x + 192 && mouseY >= y && mouseY <= y + 24;
|
||||
return mouseX >= x && mouseX <= x + 192 && mouseY >= y && mouseY <= y + height;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue