- [FIX] msgbox arreglat i redissenyat
- [FIX] Quan està el menu fora s'inhabiliten els shortcuts en l'editor - [NEW] Menu nou funcionant
This commit is contained in:
@@ -31,14 +31,15 @@ msgbox = {
|
||||
local left = (104-msgbox.h)//2
|
||||
view.clip(top, left, msgbox.w, msgbox.h)
|
||||
view.origin(top, left)
|
||||
draw.outset(0, 0, msgbox.w, msgbox.h)
|
||||
--draw.outset(0, 0, msgbox.w, msgbox.h)
|
||||
draw.rrectf(0,0,msgbox.w, msgbox.h,4,27)
|
||||
|
||||
draw.rectf(1,1,msgbox.w-2, 7, 21)
|
||||
draw.text(msgbox.title, 2, 2, 28)
|
||||
--draw.rectf(1,1,msgbox.w-2, 7, 21)
|
||||
draw.text(msgbox.title, 5, 4, 4)
|
||||
|
||||
local y = 12
|
||||
local y = 14
|
||||
for i,v in ipairs(msgbox.text) do
|
||||
draw.text(v, 5, y, 1)
|
||||
draw.text(v, 5, y, 21)
|
||||
y = y + 6
|
||||
end
|
||||
|
||||
@@ -47,27 +48,36 @@ msgbox = {
|
||||
local x = msgbox.w - 35
|
||||
y = msgbox.h - 12
|
||||
for i,v in ipairs(msgbox.buttons) do
|
||||
local inside = util.inside(mx, my, {x, y, 32, 9})
|
||||
draw.outset(x, y, 32, 9)
|
||||
if inside then
|
||||
draw.rectf(x+1,y+1,30,7,27)
|
||||
if mouse.down(mouse.LEFT) then draw.inset(x, y, 32, 9) end
|
||||
end
|
||||
local offset = (32-#v[1]*4)//2
|
||||
draw.text(v[1], x+1+offset, y+2, 1)
|
||||
if (i==msgbox.selected) then
|
||||
draw.rect(x-1, y-1, 34, 11, 1)
|
||||
end
|
||||
if mouse.press(mouse.LEFT) then
|
||||
if inside then
|
||||
v[2]()
|
||||
end
|
||||
end
|
||||
ui.pushbutton(v[1],x,y,7,22,21,v[2],msgbox.selected==i)
|
||||
--local inside = util.inside(mx, my, {x, y, 32, 9})
|
||||
--draw.outset(x, y, 32, 9)
|
||||
--if inside then
|
||||
-- draw.rectf(x+1,y+1,30,7,27)
|
||||
-- if mouse.down(mouse.LEFT) then draw.inset(x, y, 32, 9) end
|
||||
--end
|
||||
--local offset = (32-#v[1]*4)//2
|
||||
--draw.text(v[1], x+1+offset, y+2, 1)
|
||||
--if (i==msgbox.selected) then
|
||||
-- draw.rrect(x-1, y-1, 29, 10, 3, 1)
|
||||
--end
|
||||
--if mouse.press(mouse.LEFT) then
|
||||
-- if inside then
|
||||
-- v[2]()
|
||||
-- end
|
||||
--end
|
||||
x = x - 34
|
||||
end
|
||||
|
||||
if key.press(key.ESCAPE) then
|
||||
app.pop()
|
||||
elseif key.press(key.RIGHT) then
|
||||
msgbox.selected=msgbox.selected-1
|
||||
if msgbox.selected==0 then msgbox.selected = #msgbox.buttons end
|
||||
elseif key.press(key.LEFT) then
|
||||
msgbox.selected=msgbox.selected+1
|
||||
if msgbox.selected>#msgbox.buttons then msgbox.selected = 1 end
|
||||
elseif key.press(key.RETURN) then
|
||||
msgbox.buttons[msgbox.selected][2]()
|
||||
end
|
||||
end
|
||||
}
|
||||
Reference in New Issue
Block a user