imgui

The imgui library is used to allow addons to easily interact with the ImGui implementation within daochook. This library forwards the needed enumerations and flag definitions that are passed to the various ImGui function calls. This library also contains a few helper functions to do a few things with ImGui easier.

This library also forwards the implemented global table gui to imgui to make easier usage of things and to better align to the C++ style code.

Using The Library

1local imgui = require 'imgui';

Functions

col32

Converts the given ARGB color values into a 32bit color.

1number imgui.col32(a, r, g, b);
Parameter NameTypeDescription
anumberThe alpha color value.
rnumberThe red color value.
gnumberThe green color value.
bnumberThe blue color value.
Returns
(number) The converted 32bit color value.

ShowHelp

Displays a helper tag (?) that displays the given text as a tooltip when hovered.

1imgui.ShowHelp(text, same_line);
Parameter NameTypeDescription
textstringThe tooltip text to display when hovering.
same_lineboolean[Optional] Flag that states if the helper tag is displayed on the same line as the previous drawn element. (Default is true.)
Returns
None.

DisplayPopup

Displays a modal popup (similar to a message box) with configurable buttons and results.

1number imgui.DisplayPopup(title, name, cb, buttons);
Parameter NameTypeDescription
titlestringThe title to display on the popup.
namestringThe internal ImGui hashtag name of the popup.
callbackfunctionThe contents callback invoked to allow custom popup content rendering.
buttonsnumberThe button flag value used to determine which popup type to display.
Returns
number The PopupResult value.

Valid button flags are:

  • PopupButtonsOk - 0
  • PopupButtonsOkCancel - 1
  • PopupButtonsYesNo - 2
  • PopupButtonsYesNoCancel - 3

Valid popup return values are:

  • PopupResultNone - 0
  • PopupResultOk - 1
  • PopupResultCancel - 2
  • PopupResultYes - 3
  • PopupResultNo - 4