- [NEW] Convertit a mini v1.0 RC2
This commit is contained in:
@@ -15,35 +15,36 @@ menu = {
|
||||
update=function()
|
||||
--menu.old_update()
|
||||
|
||||
rectfill(9,20, 150, 34+#menu.options*10,6)
|
||||
rect(9,20, 150, 34+#menu.options*10,8)
|
||||
rect(8,19, 151, 35+#menu.options*10,6)
|
||||
draw.rectf(9,20, 141, 14+#menu.options*10,6)
|
||||
draw.rect(9,20, 141, 14+#menu.options*10,8)
|
||||
draw.rect(8,19, 143, 16+#menu.options*10,6)
|
||||
|
||||
for i,v in ipairs(menu.options) do
|
||||
color(4) if menu.selected==i then color(15) prnt(">",20,20+i*10) end
|
||||
prnt(v[1],24,20+i*10)
|
||||
local color=4
|
||||
if menu.selected==i then color=15 draw.text(">",20,20+i*10,color) end
|
||||
draw.text(v[1],24,20+i*10,color)
|
||||
end
|
||||
|
||||
if btnp(KEY_DOWN) then menu.selected=menu.selected+1 end
|
||||
if btnp(KEY_UP) then menu.selected=menu.selected-1 end
|
||||
if key.press(key.DOWN) then menu.selected=menu.selected+1 end
|
||||
if key.press(key.UP) then menu.selected=menu.selected-1 end
|
||||
if menu.selected==0 then menu.selected=#menu.options end
|
||||
if menu.selected>#menu.options then menu.selected=1 end
|
||||
|
||||
local mx,my=mouse()
|
||||
local mx,my=mouse.pos()
|
||||
if mx>=20 and mx<=140 and my>=28 and my<=(28+#menu.options*10) then
|
||||
menu.selected=math.min(1+math.floor((my-28)/10),#menu.options)
|
||||
if mbtnp(1) then
|
||||
if mouse.press(mouse.LEFT) then
|
||||
update=menu.old_update
|
||||
menu.options[menu.selected][2]()
|
||||
end
|
||||
end
|
||||
|
||||
if btnp(KEY_RETURN) then
|
||||
if key.press(key.RETURN) then
|
||||
update=menu.old_update
|
||||
menu.options[menu.selected][2]()
|
||||
end
|
||||
|
||||
if btnp(KEY_ESCAPE) then
|
||||
if key.press(key.ESCAPE) then
|
||||
if menu.return_function then
|
||||
update=menu.old_update
|
||||
menu.return_function()
|
||||
|
||||
Reference in New Issue
Block a user