Jump to content

Pixel Perfect Scaling & Mouse/Touch Events.


lznpde
 Share

Recommended Posts

http://www.photonstorm.com/phaser/pixel-perfect-scaling-a-phaser-game

 

Hi,

 

I've got the scaling working a treat, but I've been trying to get MouseEvents passed from the large canvas down to the hidden canvas using this method...

 

I'm hoping that if I can get this working that I can just update the x/y coords of the mouseevent for the hidden canvas appropriately...

pixel.canvas.addEventListener('mousedown', this._handleMouseEvent);
p._handleMouseEvent = function(event) {var newEvent = new Event(event.type, event);game.canvas.dispatchEvent(newEvent);};

So, the above appears to pass through to the Phaser canvas (with some kind of messed up x/y coords), but if I change to MouseEvent it doesn't...

p._handleMouseEvent = function(event) {var newEvent = new MouseEvent(event.type, event);game.canvas.dispatchEvent(newEvent);};

In any case, if anyone has any bright ideas they'd be appreciated... In the meantime I guess I better go looking through this stuff... https://github.com/photonstorm/phaser/tree/master/src/input

 

Ta!

 

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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