Update hud_lib_test.txt

This commit is contained in:
Niko 2025-03-06 21:44:02 +03:00 committed by GitHub
parent c46ccd1494
commit dbbec43ce9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1,6 +1,9 @@
--@name
--@client
--@owneronly
--@include hud_lib.txt
require("hud_lib.txt")
local myWindow = createWindow("Window", 100, 100, 300, 200)
addChild(myWindow, createLabel("Hello world!", 20, 50))
@ -9,12 +12,13 @@ addChild(myWindow, createButton("Ok", 20, 100, 100, 30, function()
input.enableCursor(false)
end))
hook.add("think", "toggleWindowOnInsert", function()
if input.wasKeyPressed(KEY.INSERT) then
hook.add("InputPressed", "toggleWindow", function(a)
if a == KEY.INSERT then
toggleWindow(myWindow)
end
end)
hook.add("render", "drawMyWindow", function()
drawWindow(myWindow)
end)