Jump to content

Can't get pointers to show up for touch events


jsteve
 Share

Recommended Posts

I'm simply trying to get this example to work: https://phaser.io/examples/v2/input/multi-touch

The catch is that I'm using an iPad broadcasting TUIO messages over UDP which are then converted to native browser Touch events. If I add a "touchstart" listener to the document body, I'm able to see the TouchEvents coming through. But if I monitorEvents on the document.body, I see that mouse events get translated into pointer events, but the Touch events from my TUIO pad do not. If I go into my Chrome dev tools and simulate a touch screen, I think those touches are being converted to pointer events, although it's hard to tell since it doesn't seem to disable mouse events. Any ideas? I can provide more info about my use case if needed. I wrote the TUIO->TouchEvent layer myself. The only difference between my TouchEvents and a native TouchEvent is that mine have the 'isTrusted' flag set to false since they are programmatically generated. But I don't think I saw any checks for isTrusted in the Phaser source, so I don't see why that should stop it.

If I can't get the normal input hooks to work, I could possibly use the rest of the Phaser library and handle input myself with addEventListeners. Is there any reason not to do it that way?

Thanks!

Link to comment
Share on other sites

I suspect it's because the Touch Manager never even starts listening for touch events because 'if (this.game.device.touch)' fails, which is one of its primary checks at boot-up.

Look at the docs for the Device class, specifically the 'onInitialized' Signal, because you could use that to change the value of 'device.touch' to true before the Input Manager starts up.

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...