hoist a temporary inside a function
This commit is contained in:
parent
cbe2f51382
commit
f1ddd6b8da
|
@ -2,9 +2,7 @@ draw_menu = function()
|
|||
App.color(Menu_background)
|
||||
love.graphics.rectangle('fill', 0,0, App.screen.width, Menu_bottom)
|
||||
-- settings button on right
|
||||
local w = App.width('settings')
|
||||
local r = Safe_width-w-10-5
|
||||
settings_button(r, w)
|
||||
local r = settings_button(Safe_width-5)
|
||||
local x, y = Menu_left+5, Menu_top+5
|
||||
-- main menu on left
|
||||
App.color(White)
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
settings_button = function(x, w)
|
||||
settings_button = function(x)
|
||||
local w = App.width('settings')
|
||||
local x = x-5-w-5
|
||||
styled_button('settings', x, Menu_top+5,
|
||||
function()
|
||||
Show_settings = not Show_settings
|
||||
|
@ -8,5 +10,5 @@ settings_button = function(x, w)
|
|||
love.filesystem.write('config', json.encode(settings()))
|
||||
end
|
||||
end)
|
||||
return x+w+10
|
||||
return x
|
||||
end
|
Loading…
Reference in New Issue