'next' button for mobile devices

This commit is contained in:
Kartik K. Agaram 2023-11-16 13:29:04 -08:00
parent 79ad833d63
commit 3345d055c9
5 changed files with 18 additions and 2 deletions

View File

@ -1,8 +1,17 @@
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,
})
if Draw == 'problem' then
draw_sum_grid(Problem)
elseif Draw == 'char' then
draw_sum_grid(Char)
else
draw_sum_grid(Solution)
end

View File

@ -1,5 +1,6 @@
on.initialize = function()
math.randomseed(os.time())
_, _, Safe_width, Safe_height = love.window.getSafeArea()
initialize_layout()
new()
end

View File

@ -1,4 +1,7 @@
on.mouse_press = function(x,y, mouse_button)
if mouse_press_consumed_by_any_button_handler(Buttons, x,y, mouse_button) then
return
end
if x >= X and x < X+Square_side and y >= Y and y < Y+Square_side then
Cursor = {1, 1}
elseif x >= X+Square_side and x < X+Square_side*2 and y >= Y and y < Y+Square_side then

1
0035-Buttons Normal file
View File

@ -0,0 +1 @@
Buttons = {}

2
0036-Safe_width Normal file
View File

@ -0,0 +1,2 @@
Safe_width = 0
Safe_height = 0