Lua ImGUI Dialog Windows
This script simplifies the creation of dialog windows, reducing the process to a single line of code.
Currently, there are dialog windows with buttons, integer input, string input, and RadioButtons.
Here is a brief manual
m.BtnDialog(Header, Text, strButtons, butSize) creates a dialog window with buttons and text
Header - Window title (string)
Text - Text following the title (string)
strButtons - Text displayed on the buttons (table of strings)
butSize - imgui.ImVec2, button size
m.BigBtnDialog(Header, Text, strButtons, butSize) creates a dialog window with buttons and text
strButtons - Text displayed on the buttons (table of tables of strings)
buttons from different tables strButtons are arranged in the corresponding row (e.g. {{\"1row 1\", \"1row 2\"}, {\"2row 1\", \"2row 2\"}})
m.RadioButtonDialog(Header, Text, strButtons, imint, butSize) creates a dialog window with RadioButtons
strButtons - Text displayed on the RadioButtons (table of strings)
imint - imgui.ImInt, which stores the number of the selected RadioButton (starting from one).
m.RadioButtonReturnDialog(Header, Text, strButtons, Values, imint, butSize) creates a dialog window with RadioButtons
It differs from the previous one by having Values
Values - a table of values (can also be a table of tables), the value at the index of the selected RadioButton is returned by this function.
m.InputIntDialog(Header, Text, strInts, imints, butSize) creates a dialog window for entering an integer (or integers)
strInts - a table of names for the number input fields
imints - a table of imgui.ImInt to store the values.
m.InputTextDialog(Header, Text, strings, imbufs, butSize) creates a dialog window for entering a string (or multiple strings)
strings - a table of names for the text input fields
Этот скрипт упростит написание диалоговых окон, сведёт создание диалогового окна к написанию одной строки.
На данный момент присутствуют диалоговые окна с кнопками, вводом целых чисел, вводом строк и с RadioButton.
Вот небольшой мануал
m.BtnDialog(Header, Text, strButtons, butSize) создаёт диалоговое окно с кнопками и текстом
Header - Заголовок окна(строка)
Text - Текст после заголовка(строка)
strButtons - Текст, отображаемый на кнопках(таблица строк)
butSize - imgui.ImVec2, размер кнопок
m.BigBtnDialog(Header, Text, strButtons, butSize) создаёт диалоговое окно с кнопками и текстом
strButtons - Текст, отображаемый на кнопках(таблица таблиц строк)
кнопки из разный таблиц strButtons располагаются на соответствующей строчке(ex. {{\"1stroka 1\", \"1stroka 2\"}, {\"2s 1\", \"2s 2\"}})
m.RadioButtonDialog(Header, Text, strButtons, imint, butSize) создаёт диалоговое окно с RadioButton`ами
strButtons - Текст, отображаемый на RadioButton`ах(таблица строк)
imint - imgui.ImInt, в который записывается номер выбранного RadioButton`а (с еденицы).
m.RadioButtonReturnDialog(Header, Text, strButtons, Values, imint, butSize) создаёт диалоговое окно с RadioButton`ами
От предыдущего отличается наличием Values
Values - таблица значений(может быть и таблица таблиц), значение по индексу выбранного RadioButton`а из которого возвращается этой функцией.
m.InputIntDialog(Header, Text, strInts, imints, butSize) создает диалоговое окно с вводом целого числа(целых чисел)
strInts - таблица названий для полей ввода чисел
imints - таблица imgui.ImInt для записи в них значений.
m.InputTextDialog(Header, Text, strings, imbufs, butSize) создает диалоговое окно с вводом строки(нескольких строк)
strings - таблица наименований для полей ввода текста