|
local imgui = require 'mimgui' |
|
local ffi = require 'ffi' |
|
local vkeys = require 'vkeys' |
|
|
|
local wm = require 'windows.message' |
|
local new, str, sizeof = imgui.new, ffi.string, ffi.sizeof |
|
|
|
local renderWindow = new.bool() |
|
local inputField = new.char[256 ]() |
|
local sizeX, sizeY = getScreenResolution() |
|
|
|
imgui.OnInitialize(function() |
|
imgui.GetIO().IniFilename = nil |
|
end) |
|
|
|
local newFrame = imgui.OnFrame( |
|
function() return renderWindow[0] end, |
|
function(player) |
|
imgui.SetNextWindowPos(imgui.ImVec2(sizeX / 2, sizeY / 2), imgui.Cond.FirstUseEver, imgui.ImVec2(0.5, 0.5)) |
|
imgui.SetNextWindowSize(imgui.ImVec2(200, 150), imgui.Cond.FirstUseEver) |
|
imgui.Begin("Main Window", renderWindow) |
|
imgui.Text("Hello") |
|
imgui.Text(string.format("Current render mode: %s", renderWindow[0])) |
|
if imgui.InputText("Привет", inputField, sizeof(inputField)) then |
|
|
|
print(str(inputField)) |
|
end |
|
if imgui.Button("Очистить поле") then |
|
imgui.StrCopy(inputField, '') |
|
end |
|
imgui.End() |
|
end |
|
) |
|
|
|
function main() |
|
addEventHandler('onWindowMessage', function(msg, wparam, lparam) |
|
if msg == wm.WM_KEYDOWN or msg == wm.WM_SYSKEYDOWN then |
|
if wparam == vkeys.VK_X then |
|
renderWindow[0] = not renderWindow[0] |
|
end |
|
end |
|
end) |
|
wait(-1) |
|
end |