Jump to content

Create touch events


StanLee
 Share

Recommended Posts

Hello,

 

I am trying to create some touch events manually in phaser. I am working on a tabletop and I use tangibles which are recognized by another application. This application uses the TUIO protocol to send all touchpoints and all found tangibles a particular port. Now I am using Tuio.js to listen to that port and get all the touchpoints and tangibles.

The problem is that those touch points are not recognized by Phaser. I have to create touch events by myself based on the data which I get.

 

Is it possible to create a new touch event, like:

var newTouchpoint = game.input.addPointer(game, 4);

Kind regards,

StanLee

Link to comment
Share on other sites

If you only want to fool Phaser into thinking there are touch events by converting an input stream into fake data structures, then yes that should be fairly easy.  I recommend you dig into the Phaser source which is generally well structured and commented, making it quite easy to follow.  Start off with InputHandler.js then take a look into Input.js and Touch.js and I'm sure you'll find what you need.

 

If you're looking to generate fake touch events that are recognised by the device, that's generally much harder (and on mobile I believe it's nearly impossible - by design, to prevent malware from taking control of your device).

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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