Как сделать два text.buffer в окне imgui?

kyrtion

Известный
673
248
Lua:
local imgui = require('mimgui')
local ffi = require('ffi')

local new, str, sizeof, sf = imgui.new, ffi.str, ffi.sizeof, string.format

local LImgui = {
    first_text_buffer = new.char[255]('This first')
    second_text_buffer = new.char[255]('This second')
}

-- .. on frame imgui
imgui.InputText('first text buffer', LImgui.first_text_buffer, sizeof(LImgui.first_text_buffer))
imgui.InputText('second text buffer', LImgui.second_text_buffer, sizeof(LImgui.second_text_buffer))

if imgui.Button('Write in chat for test') then
    local input_first = u8:decode(str(LImgui.first_text_buffer))
    local input_second = u8:decode(str(LImgui.second_text_buffer))

    sampAddChatMessage(sf('First input: %s', input_first))
    sampAddChatMessage(sf('Second input: %s', input_second))
end