entirely rework event handling take 3
This commit is contained in:
15
startup.lua
15
startup.lua
@ -86,8 +86,17 @@ end
|
||||
local function GetClick()
|
||||
mon.setTextScale(1)
|
||||
handlers.setupConnectionHandlers()
|
||||
local result = events.pullEvent("monitor_touch")
|
||||
return result == "disconnect" and 0 or 1
|
||||
local result, eventType, eventData = events.pullEvent("monitor_touch")
|
||||
|
||||
-- eventData is {eventType, side, x, y}
|
||||
if result == "disconnect" then
|
||||
return 0, 0
|
||||
elseif type(result) == "table" and result.x and result.y then
|
||||
return result.x, result.y
|
||||
else
|
||||
-- Fallback: extract from eventData
|
||||
return eventData[3] or 0, eventData[4] or 0
|
||||
end
|
||||
end
|
||||
|
||||
local function GetActivation()
|
||||
@ -242,7 +251,7 @@ end
|
||||
|
||||
local function handleIncomingWormhole()
|
||||
local state = getState()
|
||||
|
||||
|
||||
mon.setBackgroundColor(colors.black)
|
||||
mon.clear()
|
||||
mon.setBackgroundColor(colors.red)
|
||||
|
||||
Reference in New Issue
Block a user