cleaner clickgui panels

- solid panel body instead of see-through gray, 1px dark frame around
  each panel and a drop shadow behind it
- accent color line separating header from body
- text shadows on all gui text (panel titles, buttons, hud editor labels)
This commit is contained in:
froslanz
2026-10-22 11:28:55 -04:00
parent 30ccc6ea5a
commit 8eaec3cc4f
3 changed files with 26 additions and 6 deletions
+24 -4
View File
@@ -2,6 +2,7 @@ package cc.fros.features.gui;
import cc.fros.util.render.FrosFont;
import cc.fros.Fros;
import cc.fros.features.Feature;
import cc.fros.features.gui.items.Item;
import cc.fros.features.gui.items.buttons.Button;
@@ -52,11 +53,30 @@ public class Widget
this.context = context;
this.drag(mouseX, mouseY);
float totalItemHeight = this.open ? this.getTotalItemHeight() - 2.0f : 0.0f;
int color = ClickGuiModule.getInstance().topColor.getValue().getRGB();
context.fill(this.x, this.y - 1, this.x + this.width, this.y + this.height - 6, ClickGuiModule.getInstance().rainbow.getValue() ? ColorUtil.rainbow(ClickGuiModule.getInstance().rainbowHue.getValue()).getRGB() : color);
boolean rainbow = ClickGuiModule.getInstance().rainbow.getValue();
int headerColor = rainbow
? ColorUtil.rainbow(ClickGuiModule.getInstance().rainbowHue.getValue()).getRGB()
: ClickGuiModule.getInstance().topColor.getValue().getRGB();
int accent = rainbow
? ColorUtil.rainbow(ClickGuiModule.getInstance().rainbowHue.getValue()).getRGB()
: Fros.colorManager.getColorAsInt();
int headerTop = this.y - 1;
int headerBottom = this.y + this.height - 6;
int panelBottom = this.open ? Math.round(this.y + this.height + totalItemHeight) : headerBottom;
// drop shadow behind the whole panel
context.fill(this.x + 2, headerTop + 2, this.x + this.width + 2, panelBottom + 2, 0x50000000);
context.fill(this.x, headerTop, this.x + this.width, headerBottom, headerColor);
if (this.open) {
RenderUtil.rect(context, this.x, (float) this.y + 12.5f, this.x + this.width, (float) (this.y + this.height) + totalItemHeight, 0x77000000);
RenderUtil.rect(context, this.x, headerBottom, this.x + this.width, panelBottom, 0xE6141414);
}
// frame the panel and separate the header with an accent line
RenderUtil.rect(context, this.x, headerTop, this.x + this.width, panelBottom, 0x99000000, 1.0f);
context.fill(this.x, headerBottom - 1, this.x + this.width, headerBottom, accent);
drawString(this.getName(), (float) this.x + 3.0f, (float) this.y - 4.0f - (float) FrosGui.getClickGui().getTextOffset(), -1);
ScissorUtil.enable(context, x, 0, x + width, mc.getWindow().getGuiScaledHeight());
@@ -195,6 +215,6 @@ public class Widget
}
protected void drawString(String text, double x, double y, int color) {
FrosFont.draw(context, text, (int) x, (int) y, color);
FrosFont.draw(context, text, (int) x, (int) y, color, true);
}
}
@@ -80,7 +80,7 @@ public class Item
}
protected void drawString(GuiGraphics context, String text, double x, double y, int color) {
FrosFont.draw(context, text, (int) x, (int) y, color);
FrosFont.draw(context, text, (int) x, (int) y, color, true);
}
public boolean isHovering(int mouseX, int mouseY) {
@@ -100,7 +100,7 @@ public abstract class HudModule extends Module {
textX = x - 5 - textWidth;
}
FrosFont.draw(e.getContext(), getName(),
(int) textX, (int) (y + height / 2f - textHeight / 2f), -1);
(int) textX, (int) (y + height / 2f - textHeight / 2f), -1, true);
HudEditorScreen.getInstance().anyHover = true;
}