temporary fix improvement

This commit is contained in:
MihailRis
2025-12-08 19:21:49 +03:00
committed by ShiftyX1
parent fbc6d072e8
commit 417521e94f
2 changed files with 25 additions and 20 deletions
+18 -18
View File
@@ -1,32 +1,32 @@
local menubg
function on_menu_clear()
print("menu clear")
if menubg then
menubg:destruct()
menubg = nil
end
end
function on_menu_setup()
-- //TODO:
time.post_runnable(function()
local controller = {}
function controller.resize_menu_bg()
local w, h = unpack(gui.get_viewport())
if menubg then
menubg.region = {0, math.floor(h / 48), math.floor(w / 48), 0}
menubg.pos = {0, 0}
end
return w, h
local function setup_backround()
local controller = {}
function controller.resize_menu_bg()
local w, h = unpack(gui.get_viewport())
if menubg then
menubg.region = {0, math.floor(h / 48), math.floor(w / 48), 0}
menubg.pos = {0, 0}
end
gui.root.root:add(
"<image id='menubg' src='gui/menubg' size-func='DATA.resize_menu_bg' "..
"z-index='-1' interactive='true'/>", controller)
menubg = gui.root.menubg
controller.resize_menu_bg()
end)
return w, h
end
local bgid = random.uuid()
gui.root.root:add(string.format(
"<image id='%s' src='gui/menubg' size-func='DATA.resize_menu_bg' "..
"z-index='-1' interactive='true'/>", bgid), controller)
menubg = gui.root[bgid]
controller.resize_menu_bg()
end
function on_menu_setup()
setup_backround()
menu.page = "main"
menu.visible = true
end