sum-grid.love/0039-draw_status

28 lines
829 B
Plaintext

draw_status = function()
local w = App.width('check')
local x = Safe_width-w-20
local y = 20+love.graphics.getFont():getHeight()+50
if x < X+Square_side*2 + 50 then
-- window is too narrow; hope it's tall
y = Safe_height/2
end
button(Buttons, 'check', {x=x, y=y, w=w+10, h=love.graphics.getFont():getHeight()+10, bg={r=0.6, g=0.8, b=0.6},
icon = function(p)
App.color{r=0, g=0, b=0}
love.graphics.print('check', p.x+5, p.y+5)
end,
onpress1 = function()
Status = check_status()
end,
})
y = y+love.graphics.getFont():getHeight()
if Status == 'yes' then
w = App.width('yes!')
App.color{r=0, g=0.6, b=0}
love.graphics.print('yes!', Safe_width-w-10, y+10)
elseif Status == 'no' then
w = App.width('sorry')
App.color{r=1, g=0, b=0}
love.graphics.print('sorry', Safe_width-w-10, y+10)
end
end