ImGui | Окошко

SomaGnoma

Известный
Автор темы
429
148
Версия MoonLoader
.026-beta
Как закрыть имгуи окно нажатием ESC, чтобы не показывало паузу и как закрыть имгуи окно нажав мимо окна?
 

qdIbp

Автор темы
Проверенный
1,450
1,191
Lua:
require "lib.moonloader"
require 'lib.vkeys'
local imgui = require 'imgui'

local main_window_state = imgui.ImBool(false)
function imgui.OnDrawFrame()
    if main_window_state.v then
        imgui.SetNextWindowSize(imgui.ImVec2(150, 200), imgui.Cond.FirstUseEver)
        imgui.Begin('My window', main_window_state)
            imgui.Text('Hello world')
        imgui.End()
    end
end

function onWindowMessage(m, p)
    if p == 0x1B and main_window_state.v then
        consumeWindowMessage()
        main_window_state.v = false
    end
end

function main()
    while true do wait(0)
        if isKeyJustPressed(VK_X) then main_window_state.v = not main_window_state.v end
        imgui.Process = main_window_state.v
    end
end
 
  • Влюблен
Реакции: SomaGnoma