aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/cc/polyfrost/oneconfig/hud/SingleTextHud.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/cc/polyfrost/oneconfig/hud/SingleTextHud.java')
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/hud/SingleTextHud.java48
1 files changed, 43 insertions, 5 deletions
diff --git a/src/main/java/cc/polyfrost/oneconfig/hud/SingleTextHud.java b/src/main/java/cc/polyfrost/oneconfig/hud/SingleTextHud.java
index ac95af4..8ad93de 100644
--- a/src/main/java/cc/polyfrost/oneconfig/hud/SingleTextHud.java
+++ b/src/main/java/cc/polyfrost/oneconfig/hud/SingleTextHud.java
@@ -29,18 +29,38 @@ package cc.polyfrost.oneconfig.hud;
import cc.polyfrost.oneconfig.config.annotations.Dropdown;
import cc.polyfrost.oneconfig.config.annotations.Switch;
import cc.polyfrost.oneconfig.config.annotations.Text;
+import cc.polyfrost.oneconfig.config.core.OneColor;
+import cc.polyfrost.oneconfig.libs.universal.UMatrixStack;
-import java.util.Collections;
import java.util.List;
public abstract class SingleTextHud extends TextHud {
- public SingleTextHud(String title, boolean enabled) {
- this(title, enabled, 0, 0);
+ /**
+ * @param enabled If the hud is enabled
+ * @param x X-coordinate of hud on a 1080p display
+ * @param y Y-coordinate of hud on a 1080p display
+ * @param scale Scale of the hud
+ * @param background If the HUD should have a background
+ * @param rounded If the corner is rounded or not
+ * @param cornerRadius Radius of the corner
+ * @param width The width
+ * @param height The height
+ * @param bgColor Background color
+ * @param border If the hud has a border or not
+ * @param borderSize Thickness of the border
+ * @param borderColor The color of the border
+ */
+ public SingleTextHud(String title, boolean enabled, float x, float y, float scale, boolean background, boolean rounded, float cornerRadius, float width, float height, OneColor bgColor, boolean border, float borderSize, OneColor borderColor) {
+ super(enabled, x, y, scale, background, rounded, cornerRadius, width, height, bgColor, border, borderSize, borderColor);
+ this.title = title;
}
public SingleTextHud(String title, boolean enabled, int x, int y) {
- super(enabled, x, y);
- this.title = title;
+ this(title, enabled, x, y, 1f, true, false, 2, 56, 18, new OneColor(0, 0, 0, 120), false, 2, new OneColor(0, 0, 0));
+ }
+
+ public SingleTextHud(String title, boolean enabled) {
+ this(title, enabled, 0, 0);
}
/**
@@ -60,6 +80,24 @@ public abstract class SingleTextHud extends TextHud {
}
@Override
+ public void drawAll(UMatrixStack matrices, boolean example) {
+ if (!example && !shouldShow()) return;
+ preRender(example);
+ float contentWidth = getWidth(scale, example);
+ float contentHeight = getHeight(scale, example);
+ position.setSize(Math.max(contentWidth, paddingX * scale), Math.max(contentHeight, paddingY * scale));
+ if (shouldDrawBackground() && background)
+ drawBackground(position.getX(), position.getY(), position.getWidth(), position.getHeight(), scale);
+ draw(
+ matrices,
+ position.getX() + position.getWidth() / 2f - contentWidth / 2f,
+ position.getY() + position.getHeight() / 2f - contentHeight / 2f,
+ scale,
+ example
+ );
+ }
+
+ @Override
protected void getLines(List<String> lines, boolean example) {
lines.add(getCompleteText(getText(example)));
}