Show / Hide Table of Contents

# Class UiBuilder

This class represents the Dalamud UI that is drawn on top of the game. It can be used to draw custom windows and overlays.

##### Inheritance

System.Object
UiBuilder

##### Implements

System.IDisposable

##### 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 sealed class UiBuilder : IDisposable

### Properties

| Improve this Doc View Source

#### CutsceneActive

Gets a value indicating whether or not a cutscene is playing.

##### Declaration

    public bool CutsceneActive { get; }

##### Property Value

Type | Description
--- | ---
System.Boolean |

| Improve this Doc View Source

#### DefaultFont

Gets the default Dalamud font based on Noto Sans CJK Medium in 17pt - supporting all game languages and icons.

##### Declaration

    public static ImFontPtr DefaultFont { get; }

##### Property Value

Type | Description
--- | ---
ImFontPtr |

| Improve this Doc View Source

#### Device

Gets the game's active Direct3D device.

##### Declaration

    public Device Device { get; }

##### Property Value

Type | Description
--- | ---
Device |

| Improve this Doc View Source

#### DisableAutomaticUiHide

Gets or sets a value indicating whether this plugin should hide its UI automatically when the game's UI is hidden.

##### Declaration

    public bool DisableAutomaticUiHide { get; set; }

##### Property Value

Type | Description
--- | ---
System.Boolean |

| Improve this Doc View Source

#### DisableCutsceneUiHide

Gets or sets a value indicating whether this plugin should hide its UI automatically during cutscenes.

##### Declaration

    public bool DisableCutsceneUiHide { get; set; }

##### Property Value

Type | Description
--- | ---
System.Boolean |

| Improve this Doc View Source

#### DisableGposeUiHide

Gets or sets a value indicating whether this plugin should hide its UI automatically while gpose is active.

##### Declaration

    public bool DisableGposeUiHide { get; set; }

##### Property Value

Type | Description
--- | ---
System.Boolean |

| Improve this Doc View Source

#### DisableUserUiHide

Gets or sets a value indicating whether this plugin should hide its UI automatically when the user toggles the UI.

##### Declaration

    public bool DisableUserUiHide { get; set; }

##### Property Value

Type | Description
--- | ---
System.Boolean |

| Improve this Doc View Source

#### FrameCount

Gets the count of Draw calls made since plugin creation.

##### Declaration

    public ulong FrameCount { get; }

##### Property Value

Type | Description
--- | ---
System.UInt64 |

| Improve this Doc View Source

#### GposeActive

Gets a value indicating whether or not gpose is active.

##### Declaration

    public bool GposeActive { get; }

##### Property Value

Type | Description
--- | ---
System.Boolean |

| Improve this Doc View Source

#### IconFont

Gets the default Dalamud icon font based on FontAwesome 5 Free solid in 17pt.

##### Declaration

    public static ImFontPtr IconFont { get; }

##### Property Value

Type | Description
--- | ---
ImFontPtr |

| Improve this Doc View Source

#### MonoFont

Gets the default Dalamud monospaced font based on Inconsolata Regular in 16pt.

##### Declaration

    public static ImFontPtr MonoFont { get; }

##### Property Value

Type | Description
--- | ---
ImFontPtr |

| Improve this Doc View Source

#### OverrideGameCursor

Gets or sets a value indicating whether or not the game's cursor should be overridden with the ImGui cursor.

##### Declaration

    public bool OverrideGameCursor { get; set; }

##### Property Value

Type | Description
--- | ---
System.Boolean |

| Improve this Doc View Source

#### ShouldModifyUi

Gets a value indicating whether this plugin should modify the game's interface at this time.

##### Declaration

    public bool ShouldModifyUi { get; }

##### Property Value

Type | Description
--- | ---
System.Boolean |

| Improve this Doc View Source

#### UiPrepared

Gets a value indicating whether UI functions can be used.

##### Declaration

    public bool UiPrepared { get; }

##### Property Value

Type | Description
--- | ---
System.Boolean |

| Improve this Doc View Source

#### WindowHandlePtr

Gets the game's main window handle.

##### Declaration

    public IntPtr WindowHandlePtr { get; }

##### Property Value

Type | Description
--- | ---
System.IntPtr |

### Methods

| Improve this Doc View Source

#### AddNotification(String, String, NotificationType, UInt32)

Add a notification to the notification queue.

##### Declaration

    public void AddNotification(string content, string title = null, NotificationType type = NotificationType.None, uint msDelay = 3000U)

##### Parameters

Type | Name | Description
--- | --- | ---
System.String | content | The content of the notification.
System.String | title | The title of the notification.
Dalamud.Interface.Internal.Notifications.NotificationType | type | The type of the notification.
System.UInt32 | msDelay | The time the notification should be displayed for.

| Improve this Doc View Source

#### GetGameFontHandle(GameFontStyle)

Gets a game font.

##### Declaration

    public GameFontHandle GetGameFontHandle(GameFontStyle style)

##### Parameters

Type | Name | Description
--- | --- | ---
GameFontStyle | style | Font to get.

##### Returns

Type | Description
--- | ---
GameFontHandle | Handle to the game font which may or may not be available for use yet.

| Improve this Doc View Source

#### LoadImage(Byte[])

Loads an image from a byte stream, such as a png downloaded into memory.

##### Declaration

    public TextureWrap LoadImage(byte[] imageData)

##### Parameters

Type | Name | Description
--- | --- | ---
System.Byte[] | imageData | A byte array containing the raw image data.

##### Returns

Type | Description
--- | ---
TextureWrap | A TextureWrap object wrapping the created image. Use ImGuiHandle inside ImGui.Image().

| Improve this Doc View Source

#### LoadImage(String)

Loads an image from the specified file.

##### Declaration

    public TextureWrap LoadImage(string filePath)

##### Parameters

Type | Name | Description
--- | --- | ---
System.String | filePath | The full filepath to the image.

##### Returns

Type | Description
--- | ---
TextureWrap | A TextureWrap object wrapping the created image. Use ImGuiHandle inside ImGui.Image().

| Improve this Doc View Source

#### LoadImageAsync(Byte[])

Asynchronously loads an image from a byte stream, such as a png downloaded into memory, when it's possible to do so.

##### Declaration

    public Task<TextureWrap> LoadImageAsync(byte[] imageData)

##### Parameters

Type | Name | Description
--- | --- | ---
System.Byte[] | imageData | A byte array containing the raw image data.

##### Returns

Type | Description
--- | ---
System.Threading.Tasks.Task<TextureWrap> | A TextureWrap object wrapping the created image. Use ImGuiHandle inside ImGui.Image().

| Improve this Doc View Source

#### LoadImageAsync(String)

Asynchronously loads an image from the specified file, when it's possible to do so.

##### Declaration

    public Task<TextureWrap> LoadImageAsync(string filePath)

##### Parameters

Type | Name | Description
--- | --- | ---
System.String | filePath | The full filepath to the image.

##### Returns

Type | Description
--- | ---
System.Threading.Tasks.Task<TextureWrap> | A TextureWrap object wrapping the created image. Use ImGuiHandle inside ImGui.Image().

| Improve this Doc View Source

#### LoadImageRaw(Byte[], Int32, Int32, Int32)

Loads an image from raw unformatted pixel data, with no type or header information. To load formatted data, use LoadImage(Byte[]).

##### Declaration

    public TextureWrap LoadImageRaw(byte[] imageData, int width, int height, int numChannels)

##### Parameters

Type | Name | Description
--- | --- | ---
System.Byte[] | imageData | A byte array containing the raw pixel data.
System.Int32 | width | The width of the image contained in `imageData`.
System.Int32 | height | The height of the image contained in `imageData`.
System.Int32 | numChannels | The number of channels (bytes per pixel) of the image contained in `imageData`. This should usually be 4.

##### Returns

Type | Description
--- | ---
TextureWrap | A TextureWrap object wrapping the created image. Use ImGuiHandle inside ImGui.Image().

| Improve this Doc View Source

#### LoadImageRawAsync(Byte[], Int32, Int32, Int32)

Asynchronously loads an image from raw unformatted pixel data, with no type or header information, when it's possible to do so. To load formatted data, use LoadImage(Byte[]).

##### Declaration

    public Task<TextureWrap> LoadImageRawAsync(byte[] imageData, int width, int height, int numChannels)

##### Parameters

Type | Name | Description
--- | --- | ---
System.Byte[] | imageData | A byte array containing the raw pixel data.
System.Int32 | width | The width of the image contained in `imageData`.
System.Int32 | height | The height of the image contained in `imageData`.
System.Int32 | numChannels | The number of channels (bytes per pixel) of the image contained in `imageData`. This should usually be 4.

##### Returns

Type | Description
--- | ---
System.Threading.Tasks.Task<TextureWrap> | A TextureWrap object wrapping the created image. Use ImGuiHandle inside ImGui.Image().

| Improve this Doc View Source

#### RebuildFonts()

Call this to queue a rebuild of the font atlas.
This will invoke any Dalamud.Interface.UiBuilder.OnBuildFonts handlers and ensure that any loaded fonts are ready to be used on the next UI frame.

##### Declaration

    public void RebuildFonts()

| Improve this Doc View Source

#### RunWhenUiPrepared<T>(Func<T>, Boolean)

Waits for UI to become available for use.

##### Declaration

    public Task<T> RunWhenUiPrepared<T>(Func<T> func, bool runInFrameworkThread = false)

##### Parameters

Type | Name | Description
--- | --- | ---
System.Func<T> | func | Function to call.
System.Boolean | runInFrameworkThread | Specifies whether to call the function from the framework thread.

##### Returns

Type | Description
--- | ---
System.Threading.Tasks.Task<T> | A task that completes when the game's Present has been called at least once.

##### Type Parameters

Name | Description
--- | ---
T | Return type.

| Improve this Doc View Source

#### RunWhenUiPrepared<T>(Func<Task<T>>, Boolean)

Waits for UI to become available for use.

##### Declaration

    public Task<T> RunWhenUiPrepared<T>(Func<Task<T>> func, bool runInFrameworkThread = false)

##### Parameters

Type | Name | Description
--- | --- | ---
System.Func<System.Threading.Tasks.Task<T>> | func | Function to call.
System.Boolean | runInFrameworkThread | Specifies whether to call the function from the framework thread.

##### Returns

Type | Description
--- | ---
System.Threading.Tasks.Task<T> | A task that completes when the game's Present has been called at least once.

##### Type Parameters

Name | Description
--- | ---
T | Return type.

| Improve this Doc View Source

#### WaitForUi()

Waits for UI to become available for use.

##### Declaration

    public Task WaitForUi()

##### Returns

Type | Description
--- | ---
System.Threading.Tasks.Task | A task that completes when the game's Present has been called at least once.

### Events

| Improve this Doc View Source

#### AfterBuildFonts

Gets or sets an action that is called any time right after ImGui fonts are rebuilt.
Any ImFontPtr objects that you store can be invalidated when fonts are rebuilt (at any time), so you should both reload your custom fonts and restore those pointers inside this handler.
PLEASE remove this handler inside Dispose, or when you no longer need your fonts!

##### Declaration

    public event Action AfterBuildFonts

##### Event Type

Type | Description
--- | ---
System.Action |

| Improve this Doc View Source

#### BuildFonts

Gets or sets an action that is called any time ImGui fonts need to be rebuilt.
Any ImFontPtr objects that you store can be invalidated when fonts are rebuilt (at any time), so you should both reload your custom fonts and restore those pointers inside this handler.
PLEASE remove this handler inside Dispose, or when you no longer need your fonts!

##### Declaration

    public event Action BuildFonts

##### Event Type

Type | Description
--- | ---
System.Action |

| Improve this Doc View Source

#### Draw

The event that gets called when Dalamud is ready to draw your windows or overlays. When it is called, you can use static ImGui calls.

##### Declaration

    public event Action Draw

##### Event Type

Type | Description
--- | ---
System.Action |

| Improve this Doc View Source

#### HideUi

Gets or sets an action that is called when plugin UI or interface modifications are supposed to be shown. These may be fired consecutively.

##### Declaration

    public event Action HideUi

##### Event Type

Type | Description
--- | ---
System.Action |

| Improve this Doc View Source

#### OpenConfigUi

Event that is fired when the plugin should open its configuration interface.

##### Declaration

    public event Action OpenConfigUi

##### Event Type

Type | Description
--- | ---
System.Action |

| Improve this Doc View Source

#### ResizeBuffers

The event that is called when the game's DirectX device is requesting you to resize your buffers.

##### Declaration

    public event Action ResizeBuffers

##### Event Type

Type | Description
--- | ---
System.Action |

| Improve this Doc View Source

#### ShowUi

Gets or sets an action that is called when plugin UI or interface modifications are supposed to be hidden. These may be fired consecutively.

##### Declaration

    public event Action ShowUi

##### Event Type

Type | Description
--- | ---
System.Action |

### Explicit Interface Implementations

| Improve this Doc View Source

#### IDisposable.Dispose()

Unregister the UiBuilder. Do not call this in plugin code.

##### Declaration

    void IDisposable.Dispose()

### Implements

System.IDisposable