In my Base Control Program I define a callback function:
local function getClick(_, _, x, y, _, _)
if x > 44 and x < 50 and y == 4 and active == false then
setStatus(true)
elseif x > 44 and x < 50 and y == 4 and active == true then
setStatus(false)
elseif x > 44 and x < 50 and y == 6 and safety == false then
safety = true
elseif x > 44 and x < 50 and y == 6 and safety == true then
safety = false
elseif x > 44 and x < 50 and y == 20 and spawnEnder == false then
setSpawnEnder(true)
elseif x > 44 and x < 50 and y == 20 and spawnEnder == true then
setSpawnEnder(false)
elseif x > 44 and x < 50 and y == 22 and spawnZS == false then
setSpawnZS(true)
elseif x > 44 and x < 50 and y == 22 and spawnZS == true then
setSpawnZS(false)
elseif x == 82 and y == 1 then
shutdown()
end
end
and just before I start the main loop I create an event listener via event.listen("touch", getClick).
When I run the program and click on the screen, nothing happens.
If I try the same with the following code:
local function getClick(_, _, x, y, _, _)
print("XCoord: " ..x.. " YCoord: " ..y)
end
event.listen("touch", getClick)
while true do
end
and run the program and click on the screen, at first nothing happens, but as soon as the program crashes with "Too long without yielding!" the x and y coords for all touch events get printed correctly. If I click on the screen after the program crashed, I still get the coords printed on the screen as if the program was running.
You can post now and register later.
If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.
In my Base Control Program I define a callback function:
and just before I start the main loop I create an event listener via event.listen("touch", getClick).
When I run the program and click on the screen, nothing happens.
If I try the same with the following code:
and run the program and click on the screen, at first nothing happens, but as soon as the program crashes with "Too long without yielding!" the x and y coords for all touch events get printed correctly. If I click on the screen after the program crashed, I still get the coords printed on the screen as if the program was running.
Link to post
Share on other sites