Skip to main content
Version: 15.x (API 15) [Current]

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.

Assembly: Dalamud.dll​
Declaration
public sealed class UiBuilder : IDisposable, IUiBuilder

Implements:
System.IDisposable, Dalamud.Interface.IUiBuilder

Properties​

DefaultFontSizePt​

Gets the default Dalamud font size in points.

Declaration
public static float DefaultFontSizePt { get; }

DefaultFontSizePx​

Gets the default Dalamud font size in pixels.

Declaration
public static float DefaultFontSizePx { get; }

DefaultFont​

Gets the default Dalamud font - supporting all game languages and icons.

Accessing this static property outside of Dalamud.Interface.UiBuilder.Draw is dangerous and not supported.

Declaration
public static ImFontPtr DefaultFont { get; }

IconFont​

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

Accessing this static property outside of Dalamud.Interface.UiBuilder.Draw is dangerous and not supported.

Declaration
public static ImFontPtr IconFont { get; }

MonoFont​

Gets the default Dalamud monospaced font based on Inconsolata Regular.

Accessing this static property outside of Dalamud.Interface.UiBuilder.Draw is dangerous and not supported.

Declaration
public static ImFontPtr MonoFont { get; }

IconFontFixedWidth​

Gets the default Dalamud icon font based on FontAwesome 5 Free solid with a fixed width and vertically centered glyphs.

Accessing this static property outside of Dalamud.Interface.UiBuilder.Draw is dangerous and not supported.

Declaration
public static ImFontPtr IconFontFixedWidth { get; }

DefaultFontSpec​

Gets the default font specifications.

Declaration
public IFontSpec DefaultFontSpec { get; }

FontDefaultSizePt​

Gets the default Dalamud font size in points.

Declaration
public float FontDefaultSizePt { get; }

FontDefaultSizePx​

Gets the default Dalamud font size in pixels.

Declaration
public float FontDefaultSizePx { get; }

FontDefault​

Gets the default Dalamud font - supporting all game languages and icons.

Accessing this static property outside of Dalamud.Interface.IUiBuilder.Draw is dangerous and not supported.

Declaration
public ImFontPtr FontDefault { get; }

FontIcon​

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

Accessing this static property outside of Dalamud.Interface.IUiBuilder.Draw is dangerous and not supported.

Declaration
public ImFontPtr FontIcon { get; }

FontMono​

Gets the default Dalamud monospaced font based on Inconsolata Regular.

Accessing this static property outside of Dalamud.Interface.IUiBuilder.Draw is dangerous and not supported.

Declaration
public ImFontPtr FontMono { get; }

FontIconFixedWidth​

Gets the default Dalamud icon font based on FontAwesome 5 Free solid with a fixed width and vertically centered glyphs.

Accessing this static property outside of Dalamud.Interface.IUiBuilder.Draw is dangerous and not supported.

Declaration
public ImFontPtr FontIconFixedWidth { get; }

DefaultFontHandle​

Gets the handle to the default Dalamud font - supporting all game languages and icons.

Declaration
public IFontHandle DefaultFontHandle { get; }
Remarks​

A font handle corresponding to this font can be obtained with:

fontAtlas.NewDelegateFontHandle(
e => e.OnPreBuild(
tk => tk.AddDalamudDefaultFont(UiBuilder.DefaultFontSizePx)));

IconFontHandle​

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

Declaration
public IFontHandle IconFontHandle { get; }
Remarks​

A font handle corresponding to this font can be obtained with:

fontAtlas.NewDelegateFontHandle(
e => e.OnPreBuild(
tk => tk.AddFontAwesomeIconFont(new() { SizePt = UiBuilder.DefaultFontSizePt })));
// or use
tk => tk.AddFontAwesomeIconFont(new() { SizePx = UiBuilder.DefaultFontSizePx })));

IconFontFixedWidthHandle​

Gets the default Dalamud icon font based on FontAwesome 5 free solid with a fixed width and vertically centered glyphs.

Declaration
public IFontHandle IconFontFixedWidthHandle { get; }

MonoFontHandle​

Gets the default Dalamud monospaced font based on Inconsolata Regular.

Declaration
public IFontHandle MonoFontHandle { get; }
Remarks​

A font handle corresponding to this font can be obtained with:

fontAtlas.NewDelegateFontHandle(
e => e.OnPreBuild(
tk => tk.AddDalamudAssetFont(
DalamudAsset.InconsolataRegular,
new() { SizePt = UiBuilder.DefaultFontSizePt })));
// or use
new() { SizePx = UiBuilder.DefaultFontSizePx })));

DeviceHandle​

Gets the game's active Direct3D device.

Declaration
public nint DeviceHandle { get; }
Remarks​

Use <a href="https://learn.microsoft.com/en-us/windows/win32/api/unknwn/nf-unknwn-iunknown-queryinterface(q)"> QueryInterface</a> with IID of IID_ID3D11Device if you want to ensure that the interface type contained within is indeed an instance of ID3D11Device.

WindowHandlePtr​

Gets the game's main window handle.

Declaration
public nint WindowHandlePtr { get; }

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; }

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; }

DisableCutsceneUiHide​

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

Declaration
public bool DisableCutsceneUiHide { get; set; }

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; }

OverrideGameCursor​

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

Declaration
public bool OverrideGameCursor { get; set; }

FrameCount​

Gets the count of Draw calls made since plugin creation.

Declaration
public ulong FrameCount { get; }

CutsceneActive​

Gets a value indicating whether a cutscene is playing.

Declaration
public bool CutsceneActive { get; }

ShouldModifyUi​

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

Declaration
public bool ShouldModifyUi { get; }

UiPrepared​

Gets a value indicating whether UI functions can be used.

Declaration
public bool UiPrepared { get; }

FontAtlas​

Gets the plugin-private font atlas.

Declaration
public IFontAtlas FontAtlas { get; }

ShouldUseReducedMotion​

Gets a value indicating whether to use "reduced motion". This usually means that you should use less intrusive animations, or disable them entirely.

Declaration
public bool ShouldUseReducedMotion { get; }

PluginUISoundEffectsEnabled​

Gets a value indicating whether the user has enabled the "Enable sound effects for plugin windows" setting.

This setting is effected by the in-game "System Sounds" option and volume.

Declaration
public bool PluginUISoundEffectsEnabled { get; }

Methods​

LoadUld(string)​

Loads an ULD file that can load textures containing multiple icons in a single texture.

Declaration
public UldWrapper LoadUld(string uldPath)
Returns​

Dalamud.Interface.UldWrapper: A wrapper around said ULD file.

Parameters​
TypeNameDescription
System.StringuldPathThe path of the requested ULD file.

WaitForUi()​

Waits for UI to become available for use.

Declaration
public Task WaitForUi()
Returns​

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

RunWhenUiPrepared<T>(Func<T>, bool)​

Waits for UI to become available for use.

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

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

Parameters​
TypeNameDescription
System.Func<<T>>funcFunction to call.
System.BooleanrunInFrameworkThreadSpecifies whether to call the function from the framework thread.
Type Parameters​
NameDescription
TReturn type.

RunWhenUiPrepared<T>(Func<Task<T>>, bool)​

Waits for UI to become available for use.

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

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

Parameters​
TypeNameDescription
System.Func<System.Threading.Tasks.Task<<T>>>funcFunction to call.
System.BooleanrunInFrameworkThreadSpecifies whether to call the function from the framework thread.
Type Parameters​
NameDescription
TReturn type.

CreateFontAtlas(FontAtlasAutoRebuildMode, bool, string?)​

Creates an isolated Dalamud.Interface.ManagedFontAtlas.IFontAtlas.

Declaration
public IFontAtlas CreateFontAtlas(FontAtlasAutoRebuildMode autoRebuildMode, bool isGlobalScaled = true, string? debugName = null)
Returns​

Dalamud.Interface.ManagedFontAtlas.IFontAtlas: A new instance of Dalamud.Interface.ManagedFontAtlas.IFontAtlas.

Parameters​
TypeNameDescription
Dalamud.Interface.ManagedFontAtlas.FontAtlasAutoRebuildModeautoRebuildModeSpecify when and how to rebuild this atlas.
System.BooleanisGlobalScaledWhether the fonts in the atlas is global scaled.
System.StringdebugNameName for debugging purposes.
Remarks​

Use this to create extra font atlases, if you want to create and dispose fonts without having to rebuild all other fonts together.

If <code class="paramref">autoRebuildMode</code> is not Dalamud.Interface.ManagedFontAtlas.FontAtlasAutoRebuildMode.OnNewFrame, the font rebuilding functions must be called manually.

Events​

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​

System.Action

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​

System.Action

OpenConfigUi​

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

Declaration
public event Action? OpenConfigUi
Event Type​

System.Action

OpenMainUi​

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

Declaration
public event Action? OpenMainUi
Event Type​

System.Action

ShowUi​

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? ShowUi
Event Type​

System.Action

HideUi​

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? HideUi
Event Type​

System.Action

DefaultGlobalScaleChanged​

Invoked when the default global scale used by ImGui has been changed through Dalamud.

Declaration
public event Action? DefaultGlobalScaleChanged
Event Type​

System.Action

Remarks​

Fonts will generally not have finished rebuilding when this is invoked, so if you need to access the font you should subscribe to Dalamud.Interface.Internal.InterfaceManager.DefaultFontHandle.ImFontChanged instead.

DefaultFontChanged​

Invoked when the default font used by ImGui has been changed through Dalamud.

Declaration
public event Action? DefaultFontChanged
Event Type​

System.Action

Remarks​

Fonts will generally not have finished rebuilding when this is invoked, so if you need to access the font you should subscribe to Dalamud.Interface.Internal.InterfaceManager.DefaultFontHandle.ImFontChanged instead.

DefaultStyleChanged​

Invoked when either the currently chosen style in Dalamud or a style or color variable within the currently chosen style has been changed through Dalamud.

Declaration
public event Action? DefaultStyleChanged
Event Type​

System.Action

Implements​