22 lines
560 B
Plaintext
22 lines
560 B
Plaintext
add_def_to_menu = function(x,y, s, cursor_highlight)
|
|
local s_text = to_hud_text(s)
|
|
local width = s_text:getWidth()
|
|
if x + width > App.screen.width - 5 then
|
|
y = y + HUD_line_height + --[[highlight padding]] 5
|
|
x = 5
|
|
end
|
|
local color = Menu_background_color
|
|
if cursor_highlight then
|
|
color = Menu_highlight_color
|
|
end
|
|
button(HUD, 'menu', {x=x-5, y=y-2, w=width+5*2, h=HUD_line_height+2*2, bg=color,
|
|
onpress1 = function()
|
|
load_definition(s)
|
|
end
|
|
})
|
|
App.color(Menu_command_color)
|
|
App.screen.draw(s_text, x,y)
|
|
x = x + width + 30
|
|
return x,y
|
|
end
|