check solutions
This commit is contained in:
parent
60dce24988
commit
0f501a770f
12
0010-on.draw
12
0010-on.draw
|
@ -1,15 +1,7 @@
|
|||
on.draw = function()
|
||||
Buttons.button_handlers = {}
|
||||
local w = App.width('next')
|
||||
button(Buttons, 'next', {x=Safe_width-w-20, y=50, 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('next', p.x+5, p.y+5)
|
||||
end,
|
||||
onpress1 = function()
|
||||
animate(new)
|
||||
end,
|
||||
})
|
||||
draw_next_button()
|
||||
draw_status()
|
||||
if Draw == 'problem' then
|
||||
draw_sum_grid(Problem)
|
||||
else
|
||||
|
|
|
@ -0,0 +1,2 @@
|
|||
-- Is the answer correct?
|
||||
Status = '' -- incomplete. Can also be 'yes' or 'no'
|
|
@ -0,0 +1,12 @@
|
|||
draw_next_button = function()
|
||||
local w = App.width('next')
|
||||
button(Buttons, 'next', {x=Safe_width-w-20, y=50, 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('next', p.x+5, p.y+5)
|
||||
end,
|
||||
onpress1 = function()
|
||||
animate(new)
|
||||
end,
|
||||
})
|
||||
end
|
|
@ -0,0 +1,24 @@
|
|||
draw_status = function()
|
||||
local w = App.width('check')
|
||||
local x = Safe_width-w-20
|
||||
local y = 50+love.graphics.getFont():getHeight()+150
|
||||
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,
|
||||
})
|
||||
x = Safe_width-260
|
||||
y = y+120
|
||||
love.graphics.rectangle('line', x,y, 250,love.graphics.getFont():getHeight()+20)
|
||||
if Status == 'yes' then
|
||||
App.color{r=0, g=0.6, b=0}
|
||||
love.graphics.print('yes!', x+10, y+10)
|
||||
elseif Status == 'no' then
|
||||
App.color{r=1, g=0, b=0}
|
||||
love.graphics.print('sorry', x+10, y+10)
|
||||
end
|
||||
end
|
|
@ -0,0 +1,12 @@
|
|||
check_status = function()
|
||||
for y=1,2 do
|
||||
for x=1,2 do
|
||||
if Problem.data[y][x] == '' then
|
||||
return ''
|
||||
elseif Problem.data[y][x] ~= Solution.data[y][x] then
|
||||
return 'no'
|
||||
end
|
||||
end
|
||||
end
|
||||
return 'yes'
|
||||
end
|
Loading…
Reference in New Issue