mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-04 18:41:51 +00:00
update gui.create_frame return value
This commit is contained in:
parent
8468ab184d
commit
8ee2edef5c
5 changed files with 37 additions and 21 deletions
|
|
@ -128,11 +128,13 @@ function on_hud_open()
|
|||
hud.default_hand_controller = update_hand
|
||||
|
||||
local name = "misc/moon"
|
||||
gui.create_frame(name, name, {128, 128})
|
||||
local frame = gui.create_frame(name, name, {128, 128})
|
||||
frame:add("<button>Hello, World</button>")
|
||||
frame.color = {255, 0, 0, 255}
|
||||
|
||||
local document = Document.new(name)
|
||||
document.root:add("<button>Hello, World</button>")
|
||||
document.root.color = {255, 0, 0, 255}
|
||||
input.add_callback('key:y', function ()
|
||||
gui.set_active_frame(name)
|
||||
end)
|
||||
end
|
||||
|
||||
function on_hud_render()
|
||||
|
|
|
|||
|
|
@ -234,6 +234,14 @@ menu = _MENU
|
|||
gui.root = _GUI_ROOT
|
||||
gui.main_frame_id = "core:main"
|
||||
|
||||
local __gui_create_frame = gui.create_frame
|
||||
function gui.create_frame(id, output, size)
|
||||
__gui_create_frame(id, output, size)
|
||||
|
||||
local document = Document.new(id)
|
||||
return document.root, document
|
||||
end
|
||||
|
||||
do
|
||||
local status, err = pcall(function()
|
||||
local default_styles = toml.parse(file.read(
|
||||
|
|
@ -440,6 +448,8 @@ function __vc_on_hud_open()
|
|||
end
|
||||
elseif hud.is_inventory_open() then
|
||||
hud.close_inventory()
|
||||
elseif gui.get_active_frame() then
|
||||
gui.set_active_frame("")
|
||||
else
|
||||
hud.pause()
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue