Fixed touch issue on mobile

This commit is contained in:
Simon Cambier 2023-10-07 18:59:32 +02:00
parent fb9a663440
commit 4d4c0adb3b

View File

@ -39,7 +39,6 @@ function state_game()
local x = mid(1, (mouse_x - board_x) \ tw + 1, bw)
local y = mid(1, (mouse_y - board_y) \ tw + 1, bw)
selected_id = board:xy_idx(x,y)
-- printh("x: " .. x .. " y: " .. y .. " id: " .. selected_id)
end
local function check_endgame()
@ -62,6 +61,8 @@ function state_game()
end
local function _update()
update_mouse()
local size = board:get_size()
local x, y = board:idx_xy(selected_id)
local moved = false
@ -88,8 +89,6 @@ function state_game()
show_clues()
end
update_mouse()
if (x<1) x=size
if (x>size) x=1
if (y<1) y=size