|
local imgui = require 'mimgui' |
|
local ffi = require 'ffi' |
|
local vkeys = require 'vkeys' |
|
local encoding = require 'encoding' |
|
|
|
|
|
encoding.default = 'CP1251' |
|
|
|
local u8 = encoding.UTF8 |
|
|
|
local wm = require 'windows.message' |
|
local new, str, sizeof = imgui.new, ffi.string, ffi.sizeof |
|
|
|
local renderWindow, freezePlayer, removeCursor = new.bool(), new.bool(), 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(220, 200), imgui.Cond.FirstUseEver) |
|
imgui.Begin("Main Window", renderWindow) |
|
imgui.Text("Hello") |
|
imgui.Text(string.format("Current render mode: %s", renderWindow[0])) |
|
if imgui.InputText(u8"Привет", inputField, sizeof(inputField)) then |
|
|
|
print(u8:decode(str(inputField))) |
|
end |
|
if imgui.Button(u8"Очистить поле") then |
|
imgui.StrCopy(inputField, '') |
|
end |
|
if imgui.Checkbox(u8'Заморозить игрока', freezePlayer) then |
|
player.LockPlayer = freezePlayer[0] |
|
end |
|
if imgui.Checkbox(u8'Скрыть курсор', removeCursor) then |
|
player.HideCursor = removeCursor[0] |
|
end |
|
if player.HideCursor then |
|
imgui.Text(u8'Курсор скрыт') |
|
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 |