mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-05 02:51:49 +00:00
cleanup
This commit is contained in:
parent
0a02d3fbec
commit
9fcff65cca
5 changed files with 31 additions and 18 deletions
|
|
@ -1,13 +1,13 @@
|
|||
local menubg
|
||||
|
||||
function on_screen_changed(screen)
|
||||
if screen ~= "menu" then
|
||||
if menubg then
|
||||
menubg:destruct()
|
||||
menubg = nil
|
||||
end
|
||||
return
|
||||
local function clear_menu()
|
||||
if menubg then
|
||||
menubg:destruct()
|
||||
menubg = nil
|
||||
end
|
||||
end
|
||||
|
||||
local function configure_menu()
|
||||
local controller = {}
|
||||
function controller.resize_menu_bg()
|
||||
local w, h = unpack(gui.get_viewport())
|
||||
|
|
@ -19,8 +19,16 @@ function on_screen_changed(screen)
|
|||
end
|
||||
_GUI_ROOT.root:add(
|
||||
"<image id='menubg' src='gui/menubg' size-func='DATA.resize_menu_bg' "..
|
||||
"z-index='-1000' interactive='true'/>", controller)
|
||||
"z-index='-1' interactive='true'/>", controller)
|
||||
menubg = _GUI_ROOT.menubg
|
||||
controller.resize_menu_bg()
|
||||
menu.page = "main"
|
||||
end
|
||||
|
||||
function on_screen_changed(screen)
|
||||
if screen ~= "menu" then
|
||||
clear_menu()
|
||||
else
|
||||
configure_menu()
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue