Class ImGuiHelpers
Class containing various helper methods for use with ImGui inside Dalamud.
Inheritance
Inherited Members
Namespace: Dalamud.Interface
Assembly: Dalamud.dll
Syntax
public static class ImGuiHelpers
Properties
| Improve this Doc View SourceGlobalScale
Gets the global Dalamud scale.
Declaration
public static float GlobalScale { get; }
Property Value
| Type | Description |
|---|---|
| System.Single |
MainViewport
Gets the main viewport.
Declaration
public static ImGuiViewportPtr MainViewport { get; }
Property Value
| Type | Description |
|---|---|
| ImGuiViewportPtr |
Methods
| Improve this Doc View SourceCenterCursorFor(Int32)
Center the ImGui cursor for an item with a certain width.
Declaration
public static void CenterCursorFor(int itemWidth)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | itemWidth | The width to center for. |
CenterCursorForText(String)
Center the ImGui cursor for a certain text.
Declaration
public static void CenterCursorForText(string text)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | text | The text to center for. |
CenteredText(String)
Show centered text.
Declaration
public static void CenteredText(string text)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | text | Text to show. |
ClickToCopyText(String, String)
Print out text that can be copied when clicked.
Declaration
public static void ClickToCopyText(string text, string textCopy = null)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | text | The text to show. |
| System.String | textCopy | The text to copy when clicked. |
CopyGlyphsAcrossFonts(Nullable<ImFontPtr>, Nullable<ImFontPtr>, Boolean, Boolean, Int32, Int32)
Fills missing glyphs in target font from source font, if both are not null.
Declaration
public static void CopyGlyphsAcrossFonts(ImFontPtr? source, ImFontPtr? target, bool missingOnly, bool rebuildLookupTable, int rangeLow = 32, int rangeHigh = 65534)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Nullable<ImFontPtr> | source | Source font. |
| System.Nullable<ImFontPtr> | target | Target font. |
| System.Boolean | missingOnly | Whether to copy missing glyphs only. |
| System.Boolean | rebuildLookupTable | Whether to call target.BuildLookupTable(). |
| System.Int32 | rangeLow | Low codepoint range to copy. |
| System.Int32 | rangeHigh | High codepoing range to copy. |
DefaultColorPalette(Int32)
Creates default color palette for use with color pickers.
Declaration
public static List<Vector4> DefaultColorPalette(int swatchCount = 32)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | swatchCount | The total number of swatches to use. |
Returns
| Type | Description |
|---|---|
| System.Collections.Generic.List<System.Numerics.Vector4> | Default color palette. |
ForceNextWindowMainViewport()
Force the next ImGui window to stay inside the main game window.
Declaration
public static void ForceNextWindowMainViewport()
GetButtonSize(String)
Get the size of a button considering the default frame padding.
Declaration
public static Vector2 GetButtonSize(string text)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | text | Text in the button. |
Returns
| Type | Description |
|---|---|
| System.Numerics.Vector2 | System.Numerics.Vector2 with the size of the button. |
ImGuiKeyToVirtualKey(ImGuiKey)
Map an ImGuiKey enum value to a VirtualKey code.
Declaration
public static VirtualKey ImGuiKeyToVirtualKey(ImGuiKey key)
Parameters
| Type | Name | Description |
|---|---|---|
| ImGuiKey | key | The ImGuiKey value to retrieve the VirtualKey counterpart for. |
Returns
| Type | Description |
|---|---|
| VirtualKey | The VirtualKey that corresponds to this ImGuiKey, or |
SafeTextColoredWrapped(Vector4, String)
Write unformatted text wrapped.
Declaration
public static void SafeTextColoredWrapped(Vector4 color, string text)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Numerics.Vector4 | color | The color of the text. |
| System.String | text | The text to write. |
SafeTextWrapped(String)
Write unformatted text wrapped.
Declaration
public static void SafeTextWrapped(string text)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | text | The text to write. |
ScaledDummy(Vector2)
Create a dummy scaled by the global Dalamud scale.
Declaration
public static void ScaledDummy(Vector2 size)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Numerics.Vector2 | size | The size of the dummy. |
ScaledDummy(Single)
Create a dummy scaled by the global Dalamud scale.
Declaration
public static void ScaledDummy(float size)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Single | size | The size of the dummy. |
ScaledDummy(Single, Single)
Create a dummy scaled by the global Dalamud scale.
Declaration
public static void ScaledDummy(float x, float y)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Single | x | Vector2 X parameter. |
| System.Single | y | Vector2 Y parameter. |
ScaledRelativeSameLine(Single, Single)
Use a relative ImGui.SameLine() from your current cursor position, scaled by the Dalamud global scale.
Declaration
public static void ScaledRelativeSameLine(float offset, float spacing = -1F)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Single | offset | The offset from your current cursor position. |
| System.Single | spacing | The spacing to use. |
ScaledVector2(Single)
Gets a System.Numerics.Vector2 that is pre-scaled with the GlobalScale multiplier.
Declaration
public static Vector2 ScaledVector2(float x)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Single | x | Vector2 X/Y parameter. |
Returns
| Type | Description |
|---|---|
| System.Numerics.Vector2 | A scaled Vector2. |
ScaledVector2(Single, Single)
Gets a System.Numerics.Vector2 that is pre-scaled with the GlobalScale multiplier.
Declaration
public static Vector2 ScaledVector2(float x, float y)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Single | x | Vector2 X parameter. |
| System.Single | y | Vector2 Y parameter. |
Returns
| Type | Description |
|---|---|
| System.Numerics.Vector2 | A scaled Vector2. |
ScaledVector4(Single, Single, Single, Single)
Gets a System.Numerics.Vector4 that is pre-scaled with the GlobalScale multiplier.
Declaration
public static Vector4 ScaledVector4(float x, float y, float z, float w)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Single | x | Vector4 X parameter. |
| System.Single | y | Vector4 Y parameter. |
| System.Single | z | Vector4 Z parameter. |
| System.Single | w | Vector4 W parameter. |
Returns
| Type | Description |
|---|---|
| System.Numerics.Vector4 | A scaled Vector2. |
SetNextWindowPosRelativeMainViewport(Vector2, ImGuiCond, Vector2)
Set the position of the next window relative to the main viewport.
Declaration
public static void SetNextWindowPosRelativeMainViewport(Vector2 position, ImGuiCond condition = ImGuiCond.None, Vector2 pivot = default(Vector2))
Parameters
| Type | Name | Description |
|---|---|---|
| System.Numerics.Vector2 | position | The position of the next window. |
| ImGuiCond | condition | When to set the position. |
| System.Numerics.Vector2 | pivot | The pivot to set the position around. |
SetWindowPosRelativeMainViewport(String, Vector2, ImGuiCond)
Set the position of a window relative to the main viewport.
Declaration
public static void SetWindowPosRelativeMainViewport(string name, Vector2 position, ImGuiCond condition = ImGuiCond.None)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | name | The name/ID of the window. |
| System.Numerics.Vector2 | position | The position of the window. |
| ImGuiCond | condition | When to set the position. |
VirtualKeyToImGuiKey(VirtualKey)
Map a VirtualKey keycode to an ImGuiKey enum value.
Declaration
public static ImGuiKey VirtualKeyToImGuiKey(VirtualKey key)
Parameters
| Type | Name | Description |
|---|---|---|
| VirtualKey | key | The VirtualKey value to retrieve the ImGuiKey counterpart for. |
Returns
| Type | Description |
|---|---|
| ImGuiKey | The ImGuiKey that corresponds to this VirtualKey, or |