Skip to content

Commit

Permalink
Merge pull request #297 from RedthMC/develop
Browse files Browse the repository at this point in the history
  • Loading branch information
Wyvest authored Nov 26, 2023
2 parents 038abc6 + 8ff0051 commit 4a85ded
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions src/main/java/cc/polyfrost/oneconfig/hud/SingleTextHud.java
Original file line number Diff line number Diff line change
Expand Up @@ -97,12 +97,12 @@ protected void getLinesFrequent(List<String> lines, boolean example) {
@Override
public void draw(UMatrixStack matrices, float x, float y, float scale, boolean example) {
float textX = x;
if (brackets){
if (brackets) {
drawLine("[", textX, y, bracketsColor, scale);
textX += getLineWidth("[", scale);
}
drawLine(lines.get(0), textX, y, scale);
if (brackets){
if (brackets) {
textX += getLineWidth(lines.get(0), scale);
drawLine("]", textX, y, bracketsColor, scale);
}
Expand Down Expand Up @@ -131,27 +131,29 @@ protected final String getCompleteText(String text) {

@Override
protected float getWidth(float scale, boolean example) {
return getLineWidth((brackets? "[" : 0) + lines.get(0) + (brackets? "]" : 0), scale);
if (lines == null) return 0f;
if (!brackets) return getLineWidth(lines.get(0), scale);
return getLineWidth("[" + lines.get(0) + "]", scale);
}

@Switch(
name = "Brackets"
name = "Brackets"
)
protected boolean brackets = false;

@Color(
name = "Brackets Color"
name = "Brackets Color"
)
protected OneColor bracketsColor = new OneColor(0xFFFFFFFF);

@Text(
name = "Title"
name = "Title"
)
protected String title;

@Dropdown(
name = "Title Location",
options = {"Left", "Right"}
name = "Title Location",
options = {"Left", "Right"}
)
protected int titleLocation = 0;
}

0 comments on commit 4a85ded

Please sign in to comment.