I am testing Defold. I am trying to recognize mouse clicks. I have a game object with the following script. I only get mouse position, no pressed or released. Also, I can get key clicks (I removed that for this test).
– t_to_str converts a LUA table to a string.
function t_to_str(t)
s = ""
for k, v in pairs(t) do
s = s … tostring(k) … “:” … tostring(v) … " "
end
return s
end
function init(self)
msg.post(".", “acquire_input_focus”)
end
function final(self)
msg.post(".", “release_input_focus”)
end
function on_input(self, action_id, action)
if action.pressed then
print("on_input: pressed " … t_to_str(action))
elseif action.released then
print("on_input: released " … t_to_str(action))
else
print("on_input: weird " … t_to_str(action))
end
end
I was intending to eventually use multi-touch. But that was probably a misunderstanding. If my test only needs single touch I just need to handle the mouse click and that will also handle single touch?
Good question. I know for a fact that if you have multi-touch and mouse left button bound to the same trigger action then it messes up single touch. @Ragnar_Svensson maybe knows more?
Thanks. We have two issues related to multi-touch: DEF-1726 and DEF-2024. We should probably give these a bit higher priority in the next planning meeting @jakob.pogulis?
Though I agree with you, the backlog looks kind of packed for the next sprints. Maybe @Sara (or @saracederberg?) could give a better answer in case we could move something around.
Is this already fixed?
I cannot bind mouse and multitouch to the same action id name “touch”. If I do, I only get multitouch input on mobile, and nothing on PC. But if I set separated IDs, trying to find a hack like “touch” and “mtouch”, then I get fine input on PC, but now I got BOTH “touch” and “mtouch” on mobile… so I’ll need a 2nd hack to ignore “touch” on mobile platform
Also, tested that is not supported on HTML 5.
Would be nice to have multi-touch on HTML5, the full screen mode makes the game looks like a native app when opening in a mobile browser, is perfect for sending a game demo to people with a simple web link.