2017-07-13 16:21:37 +00:00
|
|
|
// Phaser.Input.Pointer
|
|
|
|
|
|
|
|
var Class = require('../utils/Class');
|
|
|
|
|
|
|
|
var Pointer = new Class({
|
|
|
|
|
|
|
|
initialize:
|
|
|
|
|
|
|
|
function Pointer (manager)
|
|
|
|
{
|
|
|
|
this.manager = manager;
|
|
|
|
|
|
|
|
this.x = 0;
|
|
|
|
this.y = 0;
|
|
|
|
|
|
|
|
this.isDown = false;
|
2017-07-14 00:38:21 +00:00
|
|
|
|
|
|
|
this.dirty = false;
|
|
|
|
|
|
|
|
this.justDown = false;
|
|
|
|
this.justUp = false;
|
|
|
|
this.justMoved = false;
|
|
|
|
},
|
|
|
|
|
|
|
|
reset: function ()
|
|
|
|
{
|
|
|
|
this.dirty = false;
|
|
|
|
this.justDown = false;
|
|
|
|
this.justUp = false;
|
|
|
|
this.justMoved = false;
|
2017-07-13 16:21:37 +00:00
|
|
|
},
|
|
|
|
|
2017-07-14 00:38:21 +00:00
|
|
|
move: function (event)
|
2017-07-13 16:21:37 +00:00
|
|
|
{
|
2017-07-14 00:38:21 +00:00
|
|
|
this.dirty = true;
|
|
|
|
|
2017-07-13 16:21:37 +00:00
|
|
|
this.x = event.x;
|
|
|
|
this.y = event.y;
|
2017-07-14 00:38:21 +00:00
|
|
|
|
|
|
|
this.justMoved = true;
|
|
|
|
},
|
|
|
|
|
|
|
|
down: function (event)
|
|
|
|
{
|
|
|
|
this.dirty = true;
|
|
|
|
|
|
|
|
this.x = event.x;
|
|
|
|
this.y = event.y;
|
|
|
|
|
|
|
|
this.justDown = true;
|
|
|
|
},
|
|
|
|
|
|
|
|
up: function (event)
|
|
|
|
{
|
|
|
|
this.dirty = true;
|
|
|
|
|
|
|
|
this.x = event.x;
|
|
|
|
this.y = event.y;
|
|
|
|
|
|
|
|
this.justUp = true;
|
2017-07-13 16:21:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
module.exports = Pointer;
|