Как называется элемент imgui ?

cort

Активный
Автор темы
275
79
Версия MoonLoader
.026-beta
Как называется имгуи такая штука как imput text, но большой и чтобы туда нельзя было писать текст свой и стирать мой??
 

Royan_Millans

Известный
145
182
imgui.h:
ImGuiInputTextFlags_ReadOnly            = 1 << 14,  // Read-only mode

В lua imgui этот флаг можно достать через
Код:
imgui.InputTextFlags.ReadOnly

Использование::
imgui.InputTextMultiline("id", text, /*размер в imgui.ImVec2(x, y) или nil*/, imgui.InputTextFlags.ReadOnly)
 
Последнее редактирование:

cort

Активный
Автор темы
275
79
imgui.h:
ImGuiInputTextFlags_ReadOnly            = 1 << 14,  // Read-only mode

В lua imgui этот флаг можно достать через
Код:
imgui.InputTextFlags.ReadOnly

Использование::
imgui.InputTextMultiline("id", text, /*размер в imgui.ImVec2(x, y) или nil*/, imgui.InputTextFlags.ReadOnly)
Lua:
[16:49:26.658600] (error)    Leader Tools: D:\My Games\GTA bandana\moonloader\LeaderTools.lua:812: stack index 2, expected userdata, received string: value is not a valid userdata (bad argument into 'bool(const char*, ImBuffer*, sol::optional<ImVec2 const *>, sol::optional<int>, sol::optional<ImCallback *>)')
stack traceback:
    [C]: in function 'InputTextMultiline'
    D:\My Games\GTA bandana\moonloader\LeaderTools.lua:812: in function 'OnDrawFrame'
    D:\My Games\GTA bandana\moonloader\lib\imgui.lua:1378: in function <D:\My Games\GTA bandana\moonloader\lib\imgui.lua:1367>
[16:49:26.660102] (error)    Leader Tools: Script died due to an error. (1023864C)


Lua:
if imgui.CollapsingHeader(u8'Правила никнеймов') then
                if servera.v == 0 then
                    imgui.InputTextMultiline("##rnick01", 'rules', imgui.ImVec2(425, 195), imgui.InputTextFlags.ReadOnly)
                end
                if servera.v == 1 then
                    imgui.CenterText('poseidon')
                end
                if servera.v == 2 then
                    imgui.CenterText('thor')
                end
            end
 

Royan_Millans

Известный
145
182
Lua:
[16:49:26.658600] (error)    Leader Tools: D:\My Games\GTA bandana\moonloader\LeaderTools.lua:812: stack index 2, expected userdata, received string: value is not a valid userdata (bad argument into 'bool(const char*, ImBuffer*, sol::optional<ImVec2 const *>, sol::optional<int>, sol::optional<ImCallback *>)')
stack traceback:
    [C]: in function 'InputTextMultiline'
    D:\My Games\GTA bandana\moonloader\LeaderTools.lua:812: in function 'OnDrawFrame'
    D:\My Games\GTA bandana\moonloader\lib\imgui.lua:1378: in function <D:\My Games\GTA bandana\moonloader\lib\imgui.lua:1367>
[16:49:26.660102] (error)    Leader Tools: Script died due to an error. (1023864C)


Lua:
if imgui.CollapsingHeader(u8'Правила никнеймов') then
                if servera.v == 0 then
                    imgui.InputTextMultiline("##rnick01", 'rules', imgui.ImVec2(425, 195), imgui.InputTextFlags.ReadOnly)
                end
                if servera.v == 1 then
                    imgui.CenterText('poseidon')
                end
                if servera.v == 2 then
                    imgui.CenterText('thor')
                end
            end
Вторым аргументом должен быть не текст в открытом виде, а в виде imgui Buffer.
В самое начало скрипта:
rules_text = imgui.ImBuffer("Сюда текст, который тебе нужен", 256)

В OnDrawFrame:
imgui.InputTextMultiline("##rnick01", rules_text, imgui.ImVec2(425, 195), imgui.InputTextFlags.ReadOnly)
 
  • Нравится
Реакции: cort