Skip to content

Commit e517888

Browse files
committed
make debug info slightly smaller
1 parent 45df127 commit e517888

File tree

1 file changed

+28
-26
lines changed

1 file changed

+28
-26
lines changed

src/main/java/com/cleanroommc/modularui/screen/ClientScreenHandler.java

Lines changed: 28 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -486,13 +486,15 @@ public static void drawDebugScreen(@Nullable ModularScreen muiScreen, @Nullable
486486
int mouseX = context.getAbsMouseX(), mouseY = context.getAbsMouseY();
487487
int screenH = muiScreen.getScreenArea().height;
488488
int color = Color.argb(180, 40, 115, 220);
489-
int lineY = screenH - 13;
490-
Minecraft.getMinecraft().fontRenderer.drawStringWithShadow("Mouse Pos: " + mouseX + ", " + mouseY, 5, lineY, color);
491-
lineY -= 11;
492-
Minecraft.getMinecraft().fontRenderer.drawStringWithShadow("FPS: " + fpsCounter.getFps(), 5, screenH - 24, color);
489+
float scale = 0.80f;
490+
int shift = (int) (11 * scale + 0.5f);
491+
int lineY = screenH - shift - 2;
492+
GuiDraw.drawText("Mouse Pos: " + mouseX + ", " + mouseY, 5, lineY, scale, color, true);
493+
lineY -= shift;
494+
GuiDraw.drawText("FPS: " + fpsCounter.getFps(), 5, lineY, scale, color, true);
493495
LocatedWidget locatedHovered = muiScreen.getPanelManager().getTopWidgetLocated(true);
494496
if (locatedHovered != null) {
495-
drawSegmentLine(lineY -= 4, color);
497+
drawSegmentLine(lineY -= 4, scale, color);
496498
lineY -= 10;
497499

498500
IGuiElement hovered = locatedHovered.getElement();
@@ -503,52 +505,52 @@ public static void drawDebugScreen(@Nullable ModularScreen muiScreen, @Nullable
503505
Area area = hovered.getArea();
504506
IGuiElement parent = hovered.getParent();
505507

506-
GuiDraw.drawBorder(0, 0, area.width, area.height, color, 1f);
508+
GuiDraw.drawBorder(0, 0, area.width, area.height, color, scale);
507509
if (hovered.hasParent()) {
508-
GuiDraw.drawBorder(-area.rx, -area.ry, parent.getArea().width, parent.getArea().height, Color.withAlpha(color, 0.3f), 1f);
510+
GuiDraw.drawBorder(-area.rx, -area.ry, parent.getArea().width, parent.getArea().height, Color.withAlpha(color, 0.3f), scale);
509511
}
510512
GlStateManager.popMatrix();
511513
locatedHovered.unapplyMatrix(context);
512-
GuiDraw.drawText("Pos: " + area.x + ", " + area.y + " Rel: " + area.rx + ", " + area.ry, 5, lineY, 1, color, false);
513-
lineY -= 11;
514-
GuiDraw.drawText("Size: " + area.width + ", " + area.height, 5, lineY, 1, color, false);
515-
lineY -= 11;
516-
GuiDraw.drawText("Class: " + hovered, 5, lineY, 1, color, false);
514+
GuiDraw.drawText("Pos: " + area.x + ", " + area.y + " Rel: " + area.rx + ", " + area.ry, 5, lineY, scale, color, true);
515+
lineY -= shift;
516+
GuiDraw.drawText("Size: " + area.width + ", " + area.height, 5, lineY, scale, color, true);
517+
lineY -= shift;
518+
GuiDraw.drawText("Class: " + hovered, 5, lineY, scale, color, true);
517519
if (hovered.hasParent()) {
518-
drawSegmentLine(lineY -= 4, color);
520+
drawSegmentLine(lineY -= 4, scale, color);
519521
lineY -= 10;
520522
area = parent.getArea();
521-
GuiDraw.drawText("Parent size: " + area.width + ", " + area.height, 5, lineY, 1, color, false);
522-
lineY -= 11;
523-
GuiDraw.drawText("Parent: " + parent, 5, lineY, 1, color, false);
523+
GuiDraw.drawText("Parent size: " + area.width + ", " + area.height, 5, lineY, scale, color, true);
524+
lineY -= shift;
525+
GuiDraw.drawText("Parent: " + parent, 5, lineY, scale, color, true);
524526
}
525527
if (hovered instanceof ItemSlot slotWidget) {
526-
drawSegmentLine(lineY -= 4, color);
528+
drawSegmentLine(lineY -= 4, scale, color);
527529
lineY -= 10;
528530
ModularSlot slot = slotWidget.getSlot();
529-
GuiDraw.drawText("Slot Index: " + slot.getSlotIndex(), 5, lineY, 1, color, false);
530-
lineY -= 11;
531-
GuiDraw.drawText("Slot Number: " + slot.slotNumber, 5, lineY, 1, color, false);
532-
lineY -= 11;
531+
GuiDraw.drawText("Slot Index: " + slot.getSlotIndex(), 5, lineY, scale, color, false);
532+
lineY -= shift;
533+
GuiDraw.drawText("Slot Number: " + slot.slotNumber, 5, lineY, scale, color, false);
534+
lineY -= shift;
533535
if (slotWidget.isSynced()) {
534536
SlotGroup slotGroup = slot.getSlotGroup();
535537
boolean allowShiftTransfer = slotGroup != null && slotGroup.allowShiftTransfer();
536-
GuiDraw.drawText("Shift-Click Priority: " + (allowShiftTransfer ? slotGroup.getShiftClickPriority() : "DISABLED"), 5, lineY, 1, color, false);
538+
GuiDraw.drawText("Shift-Click Priority: " + (allowShiftTransfer ? slotGroup.getShiftClickPriority() : "DISABLED"), 5, lineY, scale, color, true);
537539
}
538540
} else if (hovered instanceof RichTextWidget richTextWidget) {
539-
drawSegmentLine(lineY -= 4, color);
541+
drawSegmentLine(lineY -= 4, scale, color);
540542
lineY -= 10;
541543
Object hoveredElement = richTextWidget.getHoveredElement();
542-
GuiDraw.drawText("Hovered: " + hoveredElement, 5, lineY, 1, color, false);
544+
GuiDraw.drawText("Hovered: " + hoveredElement, 5, lineY, scale, color, true);
543545
}
544546
}
545547
// dot at mouse pos
546548
GuiDraw.drawRect(mouseX, mouseY, 1, 1, Color.withAlpha(Color.GREEN.main, 0.8f));
547549
GlStateManager.color(1f, 1f, 1f, 1f);
548550
}
549551

550-
private static void drawSegmentLine(int y, int color) {
551-
GuiDraw.drawRect(5, y, 140, 1, color);
552+
private static void drawSegmentLine(int y, float scale, int color) {
553+
GuiDraw.drawRect(5, y, 140 * scale, 1 * scale, color);
552554
}
553555

554556
public static void updateGuiArea(GuiContainer container, Rectangle area) {

0 commit comments

Comments
 (0)