r3-custom-code/c55930et90.js

51 lines
780 B
JavaScript
Raw Normal View History

var touch = data[Object.keys(data)[0]];
console.log(touch);
if (!this.initialized) {
this.x = window.innerWidth / 2;
this.y = window.innerHeight / 2;
var sensitivity = 0.1;
this.initialized = true;
}
touch.left *= sensitivity;
touch.right *= sensitivity;
touch.up *= sensitivity;
touch.down *= sensitivity;
this.x -= touch.left;
this.x += touch.right;
this.y -= touch.up;
this.y += touch.down;
if (this.x < 0) {
this.x = 0;
}
if (this.x > window.innerWidth) {
this.x = window.innerWidth;
}
if (this.y < 0) {
this.y = 0;
}
if (this.y > window.innerHeight) {
this.y = window.innerHeight;
}
GameLib.Event.Emit(
GameLib.Event.MOUSE_MOVE,
{
event : {
offsetX : this.x,
offsetY : this.y,
target : data.event.target
}
}
)
//@ sourceURL=touchMove.js