Show / Hide Table of Contents

# Class ImGuiHelpers

Class containing various helper methods for use with ImGui inside Dalamud.

##### Inheritance

System.Object
ImGuiHelpers

##### Inherited Members

System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()

###### Namespace: Dalamud.Interface

###### Assembly: Dalamud.dll

##### Syntax

    public static class ImGuiHelpers

### Properties

| Improve this Doc View Source

#### GlobalScale

Gets the global Dalamud scale.

##### Declaration

    public static float GlobalScale { get; }

##### Property Value

Type | Description
--- | ---
System.Single |

| Improve this Doc View Source

#### MainViewport

Gets the main viewport.

##### Declaration

    public static ImGuiViewportPtr MainViewport { get; }

##### Property Value

Type | Description
--- | ---
ImGuiViewportPtr |

### Methods

| Improve this Doc View Source

#### CenterCursorFor(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.

| Improve this Doc View Source

#### 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.

| Improve this Doc View Source

#### CenteredText(String)

Show centered text.

##### Declaration

    public static void CenteredText(string text)

##### Parameters

Type | Name | Description
--- | --- | ---
System.String | text | Text to show.

| Improve this Doc View Source

#### 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.

| Improve this Doc View Source

#### 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.

| Improve this Doc View Source

#### 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.

| Improve this Doc View Source

#### ForceNextWindowMainViewport()

Force the next ImGui window to stay inside the main game window.

##### Declaration

    public static void ForceNextWindowMainViewport()

| Improve this Doc View Source

#### 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.

| Improve this Doc View Source

#### 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 `VirtualKey.NO_KEY` otherwise.

| Improve this Doc View Source

#### SafeTextWrapped(String)

Write unformatted text wrapped.

##### Declaration

    public static void SafeTextWrapped(string text)

##### Parameters

Type | Name | Description
--- | --- | ---
System.String | text | The text to write.

| Improve this Doc View Source

#### 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.

| Improve this Doc View Source

#### 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.

| Improve this Doc View Source

#### 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.

| Improve this Doc View Source

#### 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.

| Improve this Doc View Source

#### 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.

| Improve this Doc View Source

#### 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.

| Improve this Doc View Source

#### 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.

| Improve this Doc View Source

#### 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.

| Improve this Doc View Source

#### 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.

| Improve this Doc View Source

#### 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 `ImGuiKey.None` otherwise.