Gui Namespace

The gui namespace contains functions that interact with the ImGui interface of Ashita. This allows addons to create rich user interfaces.

You can access these functions via:

ashita.gui.

Because of the nature of these functions and the amount of functions that exist, I do not plan to create full documentation for each function. You can find an example of the ImGui demo application ported to an Ashita addon here instead.

It is important that when making use of the GUI functions, that your addon includes the script: 'imguidef'.
You can do this by adding the following line of code to the top of your addon:

require 'imguidef'

By including this helper file, this also exposes these GUI functions via a global 'imgui'. Instead of having to use 'ashita.gui.' before every call, instead you just need to use 'imgui.' instead. For example:

-- before
local hide = ashita.gui.GetHide();
-- after
local hide = imgui.GetHide();

Most of the calls are straight-forward and used as they are in C++. However, some of them had to have minor changes to work with Lua's types and lack of pointers. The following is a list of how things are implemented.

Please note, the following changes apply to ALL functions listed below:

Any function that takes ImVec2(…) is replaced by two float values instead.

Any function that takes ImVec4(…) is replaced by four float values instead.

Notes

InputText / InputTextMultiline - The callback, if present, should be a string that points to a callback function like this:
- The callbacks data is a imgui.ImGuiTextEditCallbackData structure instance.

if (imgui.InputText('test', test_text_input_buffer, 1024, imgui.bor(ImGuiInputTextFlags_EnterReturnsTrue,ImGuiInputTextFlags_CallbackCompletion,ImGuiInputTextFlags_CallbackHistory), 'test_callback')) then
print('Enter was pressed!');
end
function test_callback(data)
print('Callback was fired!');
return 0;
end

SetNextWindowSizeConstraints - The callback, if present, should be a string that points to a callback function like this:
- The callbacks data is a imgui.ImGuiSizeConstraintCallbackData structure instance.