Jump to content

how to rotate pointer's X Y


scofieldly
 Share

Recommended Posts

Hi all, 

Currently I try to rotate the game 90 degree to meet the portrait mode for my [landscape] game, I used other's solution to rotate all display object by

 

this.game.scale.setGameSize(, ;

and 

 

Phaser.World.prototype.displayObjectUpdateTransform = function() {
    if(!this.game.scale.correct) {
        this.x = this.game.camera.y + this.game.width;
        this.y = -this.game.camera.x;
        this.rotation = Phaser.Math.degToRad(Phaser.Math.wrapAngle(90));
    } else {
        this.x = -this.game.camera.x;
        this.y = -this.game.camera.y;
        this.rotation = 0;
    }

    PIXI.DisplayObject.prototype.updateTransform.call(this);
};

 

now all display object are rotated, but the pointer are not rotate, so when I want to do something with activePointer like:
calculation with the mouse position

drag and drop logic

 

the x, y are reversed. 

So I want to know is there any good solution to switch the x, y of the pointer, thx.

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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