xianjimli Posted July 25, 2014 Share Posted July 25, 2014 I am writing a game ui for phaser(https://github.com/drawapp8/gameui-for-phaser-js), here are some demos: http://phaserjs.sinaapp.com/demo1/ http://phaserjs.sinaapp.com/demo2 http://phaserjs.sinaapp.com/demo3 I don't know how to handle mouse move/touch move event, could anyone give me some tips? Thanks in advance. Link to comment Share on other sites More sharing options...
lewster32 Posted July 25, 2014 Share Posted July 25, 2014 Phaser handles inputs via the Pointer object, which has a position property. The current active pointer can always be determined by checking game.input.activePointer. You can also add a callback for whenever the active pointer moves by setting game.input.moveCallback to your callback, like so:game.input.moveCallback = function(pointer, x, y) { // pointer returns the active pointer, x and y return the position on the canvas} TNelson 1 Link to comment Share on other sites More sharing options...
xianjimli Posted July 26, 2014 Author Share Posted July 26, 2014 Thank you, it works now. BTW, use game.input.addMoveCallback is better. TNelson 1 Link to comment Share on other sites More sharing options...
lewster32 Posted July 26, 2014 Share Posted July 26, 2014 Whoops I missed that one - well spotted, and well done on your UI, it's excellent! Link to comment Share on other sites More sharing options...
Recommended Posts