Class ImGuiUtils
java.lang.Object
de.luckymcdev.foundryengine.client.imgui.ImGuiUtils
A Class which has static methods for
some ImGui utils.
-
Nested Class Summary
Nested Classes -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidHelper to draw something centeredstatic booleanCollapsible section header with custom tree-node flags.static booleanCollapsible section header.static ColorObtains the color of the modidstatic voiddisplayIcon(ImIcon icon) static voiddrawImage(int id, float w, float h) static voiddrawImage(ImGuiUtils.Image image) static voiddrawImageButton(int id, float w, float h) static StringformatColored(String text, Object... args) Returns a colored string formatted with the given arguments, using the standard bright-blue tint for labels.static net.minecraft.client.StringSplitterstatic ImGuiUtils.ImagegetTexture(File imageFile) static ImGuiUtils.ImagegetTexture(net.minecraft.resources.Identifier texture) static voidstatic voidstatic voidstatic voidstatic voidhelpTooltip(String text) Displays a (?) with a hover tooltip.static StringReturns an iconstatic booleaniconButton(ImIcon icon, String id) Renders a small icon button.static voididentifier(net.minecraft.resources.Identifier loc) Displays an identifier with a dimmed namespacestatic voidlabeledValue(String label, String value) Renders a colored label followed by a dimmed value on the same line.static voidPops the 3 style colors pushed bypushErrorButtonStyle().static voidPushes a red style for buttons to indicate a dangerous or error-related action.static voidstatic voidscrollableRegion(String id, float width, float height, boolean border, Runnable content) Renders a scrollable child region with explicit dimensions.static voidscrollableRegion(String id, Runnable content) Renders a scrollable child region at full available width/height with a border.static voidRenders a section header with colored text and a separator below it.static voidtextCentered(String text, float width) Helper to draw centered text.static Stringtimer(long time) static voidtreeSection(String label, Runnable body) Runsbodyinside a framed, default-open tree node.static voidRunsbodywhile the given font is pushed, then pops it.
-
Constructor Details
-
ImGuiUtils
public ImGuiUtils()
-
-
Method Details
-
helpTooltip
Displays a (?) with a hover tooltip. Useful for example information. It is rendered at the same line as the thing before it.- Parameters:
text- The tooltip text
-
pushErrorButtonStyle
public static void pushErrorButtonStyle()Pushes a red style for buttons to indicate a dangerous or error-related action. Must be paired withpopErrorButtonStyle(). -
popErrorButtonStyle
public static void popErrorButtonStyle()Pops the 3 style colors pushed bypushErrorButtonStyle(). -
icon
-
displayIcon
-
h1
-
h2
-
h3
-
h4
-
textCentered
Helper to draw centered text.- Parameters:
text- The text to renderwidth- The width of the area to center on
-
centered
Helper to draw something centered- Parameters:
runnable- What to drawitemWidth- The known width of the item(s) you are drawingtotalWidth- The width of the area to center within (usually ImGui.getContentRegionAvailX())
-
redTextIf
-
identifier
public static void identifier(net.minecraft.resources.Identifier loc) Displays an identifier with a dimmed namespace- Parameters:
loc- The identifier
-
timer
-
colorOf
-
getStringSplitter
public static net.minecraft.client.StringSplitter getStringSplitter()- Returns:
- A string splitter for ImGui fonts
-
drawImage
-
drawImage
public static void drawImage(int id, float w, float h) -
drawImageButton
public static void drawImageButton(int id, float w, float h) -
getTexture
-
getTexture
-
section
Renders a section header with colored text and a separator below it. -
scrollableRegion
-
scrollableRegion
-
collapse
-
collapse
-
labeledValue
-
withFont
Runsbodywhile the given font is pushed, then pops it. -
treeSection
-
iconButton
-
formatColored
-